Link to home
Start Free TrialLog in
Avatar of FuelUrMind
FuelUrMind

asked on

On form submit, close fancybox and go to url

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

ASKER CERTIFIED SOLUTION
Avatar of FuelUrMind
FuelUrMind

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial