Solved

On form submit, close fancybox and go to url

Posted on 2010-09-02
1
1,463 Views
Last Modified: 2012-05-10
The form is loading as an iframe overlay using fancybox. Is there a way to close the module form and redirect the parent window to the thank you page?

I'm using jval to validate the page.

Thanks in advance!

form code below:

<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST" id="Avi1" onsubmit="if ( $('#Avi1').jVal() ) { return true; } else { return false; }" >
    <INPUT type="hidden" name="oid" value="xxxx">
    <INPUT type="hidden" name="sfga" value="xxxx">
    <input type=hidden name="retURL" value="/home/ContactThankYou">
    <div class="info">
      <h2>Get Started Today!</h2>
      <div></div>
    </div>
    <ul id="Avi">
      <li class="     " id="foli1">
        <label class="desc" id="title1" for="Field1"> Name </label>
        <span>
        <input id="first_name" name="first_name" type="text" class="field text fn" value="" size="8" tabindex="1" 	jVal="{valid:function (val) { if (val.length < 3) return 'Invalid Name'; else return ''; }}"					/>
        <label for="Field1">First<span class="req">*</span></label>
        </span> <span>
        <input id="last_name" name="last_name" type="text" class="field text ln" value="" size="14" tabindex="2" 	/>
        <label for="Field2">Last</label>
        </span> </li>
      <li id="foli10" class="     ">
        <label class="desc" id="title10" for="email;"> Email <span id="req_10" class="req">*</span> </label>
        <div class="col">
          <input id="email" name="email" type="text" class="field text medium" value="" maxlength="255" tabindex="3" 	
        	jVal="{valid:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/, message:'Invalid Email Address'}"
					jValKey="{valid:/[a-zA-Z0-9._%+-@]/, cFunc:'alert', cArgs:['Email Address: '+$(this).val()]}"
        />
        </div>
      </li>
      <li id="foli13" class="     ">
        <label class="desc" id="company" for="Field13"> Company </label>
        <div class="col">
          <input id="Field13" name="company" type="text" class="field text medium" value="" maxlength="255" tabindex="4" onkeyup="" 
         	/>
        </div>
      </li>
      <li id="foli9" class="phone      ">
        <label class="desc" id="title9" for="Field9"> Phone Number </label>
        <span>
        <input id="Field9" name="areaCode" type="text" class="field text" value="" size="3" maxlength="3" tabindex="5" 	/>
        <label for="Field9">###</label>
        </span> <span class="symbol">-</span> <span>
        <input id="Field9-1" name="phoneNumber1" type="text" class="field text" value="" size="3" maxlength="3" tabindex="6" 	/>
        <label for="Field9-1">###</label>
        </span> <span class="symbol">-</span> <span>
        <input id="Field9-2" name="phoneNumber2" type="text" class="field text" value="" size="4" maxlength="4" tabindex="7" 	/>
        <label for="Field9-2">####</label>
        </span> </li>
      <li class="buttons ">
        <input id="saveForm" name="saveForm" class="btTxt submit" type="submit" value="Submit" 
        
		 onClick="if ( $('#Avi').jVal({style:'pod',padding:3,border:1,wrap:true}) ) ;"
        />
      </li>
      <li style="display:none">
        <label for="comment">Do Not Fill This Out</label>
        <textarea name="comment" id="comment" rows="1" cols="1"></textarea>
        <input type="hidden" id="idstamp" name="idstamp" value="" />
      </li>
    </ul>
  </form>

Open in new window

0
Comment
Question by:FuelUrMind
1 Comment
 

Accepted Solution

by:
FuelUrMind earned 0 total points
ID: 33591887
Sometimes I over-complicate things, target="_parent" solves this.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question