SOLVED

Re: Unable to Submit Form on Safari mobile

Go to solution
JC100
Level 2

Unable to Submit Form on Safari mobile

Hi everyone,

We've encountered an issue where a form cannot be submitted on Safari mobile. Any help please?

We've tested the form submission on Chrome desktop and Chrome mobile, and it was successful. By "successful", we mean that the page redirected to a thank you page, and a PDF was downloaded. However, on Safari mobile, the following occurred:

  • Instead of redirecting to a thank you page, the downloaded PDF opened
  • Upon returning from the PDF, a message appeared below the Download button stating "Submission failed, please try again later."

Feel free to try it out on a test page located here.

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Unable to Submit Form on Safari mobile

Sandeep is on the right track but not describing the situation exactly.

 

You (or your developer) are using the Forms 2.0 JS events incorrectly. This code in your marketo-form.js runs in an onValidate listener:

if (jQuery("#downloadlink").length > 0) {
  jQuery("#downloadlink")[0].click()
}

 

It should be running in an onSuccess listener.

 

By attempting to use onValidate, you’re starting to download the file immediately before the form is submitted. When the form is submitted and the browser navigates to the Thank You URL, this can disconnect the download if it’s still in progress. (This is clear in the HTML5 spec — document redirect aborts all fetches in progress.)

 

Move your code to onSuccess to properly maintain the state of the form.

 

 

P.S. Your domain blocking code is also broken as it’s case-sensitive. It blocks user@gmail.com  but not user@Gmail.com,  though those are by definition the same domain.

View solution in original post

5 REPLIES 5
Sandeepkumar2
Level 2

Re: Unable to Submit Form on Safari mobile

Actually the form is working but a little different when we redirects and download a file, when you submit the form the pdf gets downloaded in the background and the thank you page is opened in the background as well, so when you hits again, it shows error. 

SanfordWhiteman
Level 10 - Community Moderator

Re: Unable to Submit Form on Safari mobile


Actually the form is working but a little different when we redirects and download a file,

I would not say the form is “working”. As you’ll see in my reply, the wrong event listener is being used and the download is not guaranteed to complete.

SanfordWhiteman
Level 10 - Community Moderator

Re: Unable to Submit Form on Safari mobile

Sandeep is on the right track but not describing the situation exactly.

 

You (or your developer) are using the Forms 2.0 JS events incorrectly. This code in your marketo-form.js runs in an onValidate listener:

if (jQuery("#downloadlink").length > 0) {
  jQuery("#downloadlink")[0].click()
}

 

It should be running in an onSuccess listener.

 

By attempting to use onValidate, you’re starting to download the file immediately before the form is submitted. When the form is submitted and the browser navigates to the Thank You URL, this can disconnect the download if it’s still in progress. (This is clear in the HTML5 spec — document redirect aborts all fetches in progress.)

 

Move your code to onSuccess to properly maintain the state of the form.

 

 

P.S. Your domain blocking code is also broken as it’s case-sensitive. It blocks user@gmail.com  but not user@Gmail.com,  though those are by definition the same domain.

JC100
Level 2

Re: Unable to Submit Form on Safari mobile

Hi folks,

 

Thank you very much! I raised this question before a recent change and everything seems to be normal now on safari and wherever. For the gmail and Gmail issue, I will check out with the developer.

 

Thanks again for your help!

SanfordWhiteman
Level 10 - Community Moderator

Re: Unable to Submit Form on Safari mobile

OK, you’re still using onValidate though. That’s not right.