user3120861
user3120861

Reputation: 185

Form does not submit from mobile devices

I have a form that submits fine from desktops and laptops, but the data is not passing through when the form is submitted from a mobile device. The reason for is the need to send the user to a Survey page rather than the action URL, which is unavoidable with our marketing automation platform.

Here's what I have for the form:

<iframe name="submitFrame" id="submitFrame" width="0" height="0" style="display:none;"></iframe>
<form id="sub" name="sub" action="https://123.xxxxxxxxx.com/e/f2" method="post" target="submitFrame">

Here's the form handler:

jQuery("#sub_form").submit(function(event) {
    var form_cat = (new URL(location)).searchParams.get('cat')
    jQuery('input[name="catNumber"]').val(form_cat);  
    window.location.replace("https://testing.com/survey");

UPDATE: When I comment out the window.location.replace, the form posts from mobile devices.

Upvotes: 0

Views: 69

Answers (1)

codeHysteria127
codeHysteria127

Reputation: 97

You have typo in form tag. The ID you have id="sub" and in the jquery you calling for ID "sub_form".

Well you can change you id in div tag for sub_form or vice versa I mean in jquery change it for sub

Hope this will help you :)

Upvotes: 1

Related Questions