www.webdeveloper.com
Results 1 to 3 of 3

Thread: Form Doesn't Submit in IE

  1. #1
    Join Date
    Sep 2008
    Posts
    260

    Form Doesn't Submit in IE

    I'm wondering why this form won't submit in IE.

    I condensed the code (took out the <table> format) so anyone can read it better.

    HTML Code:
    <form action="<?php echo home_url('/'); ?>make-appointments/" method="post" name="used_search" id="contactus" style="margin:5px 0 0 10px;" onsubmit="runFieldsCheck(); window.location.reload()" accept-charset="UTF-8" >
    
    
    
    <input type='hidden' name='submitted' id='submitted' value='1' />
    <input type='hidden' name='<?php echo $mailer->GetFormIDInputName(); ?>' value='<?php echo $mailer->GetFormIDInputValue(); ?>' />
    <input type='text'  class='spmhidip' name='<?php echo $mailer->GetSpamTrapInputName(); ?>' />
    
    
    
    
    First Name:<input type="text" name="firstname" size="35" value="<?php echo htmlentities($disp_firstname) ?>" />
    Last Name:<input type="text" name="lastname" size="35" value="<?php echo htmlentities($disp_lastname) ?>" /> 
    Email Address:<input type="text" name="useremail" size="35" value="<?php echo htmlentities($disp_email) ?>" />
    Confirm Email Address:<input type="text" name="emailconfirm" size="35" value="<?php echo htmlentities($disp_emailconf) ?>" />
    Contact Phone Number:<input type="text" name="userphone" size="35" value="<?php echo htmlentities($disp_phone) ?>" />
    
    
    
    
    <input type="checkbox" name="reminder[]" value="By Phone Call" class="checkfield" /> By Phone Call
    <input type="checkbox" name="reminder[]" value="By Email" class="checkfield" /> By Email
    
    
    <input type="radio" name="waiting" value="willbewaiting" class="checkfield" /> Yes, I Will Be Waiting For My Vehicle 
    <input type="radio" name="waiting" value="notwaiting" class="checkfield" /> No, I Will Be Dropping It Off
    
    
    Date: <input type="text" id="field1" value="<?php echo htmlentities($disp_date); ?>" size="25" name="app_date" />
    Time: <input type="text" id="field2" value="<?php echo htmlentities($disp_time); ?>" size="25" name="app_time"/> 
    
    
    <input type="text" id="car_make" value="<?php echo htmlentities($disp_make); ?>" size="20" name="make" />
    <input type="text" id="car_model" value="<?php echo htmlentities($disp_model); ?>" size="20" name="model" />
    <input type="text" id="car_year" value="<?php echo htmlentities($disp_year); ?>" size="20" name="year" />
    
    <input type="checkbox" name="service[]" value="reg-maint" class="checkfield" /> Recommended Car Maintenance
    <input type="checkbox" name="service[]" value="oil-serv" class="checkfield" /> Oil Change Services 
    <input type="checkbox" name="service[]" value="tire-serv" class="checkfield" /> Tire Services
    <input type="checkbox" name="service[]" value="battery-serv" class="checkfield" /> Battery Replacement/Charging Services 
    <input type="checkbox" name="service[]" value="repair-serv" class="checkfield" /> Repairs and Diagnostic Services (Dashboard 
    <input type="checkbox" name="service[]" value="other-serv" onclick="revealTextBox()" id="other_checkbox" class="checkfield" /> Other 
    
    <input type='submit' name='Submit' value='Submit Appointment'  />
    
    
    </form>
    Now it has a some PHP calls in it, but I figured this was a JavaScript issue.

    In the above code, I have an "onsubmit" attribute inside of the <form> tag itself. The function runFieldsCheck() saves the user information in a cookie to reload just in case there are errors. I also gave it the command "window.location.reload()" to reload on the same page because the PHP does the field validation. If no errors are found then the PHP sends an email with the information and a text message.

    If there are errors, the errors are displayed in a box above the form which is displayed by "display=block".

    It works well everywhere else but IE. The form doesn't seem to submit at all in IE. Even with everything filled out it still doesn't submit. Any idea why?

  2. #2
    Join Date
    Mar 2011
    Posts
    1,140
    I suspect that you're running into problems somewhere between the attempt to save a cookie and the window.reload() during onsubmit() time. It's an unusual way of doing things like form validation.

    My advice would be to have your runFieldsCheck() function simply validate the user's entries. If the data is valid, return true. If the data is invalid, alert the user with details about the problem and return false. You'll need to change your <form> tag to:
    Code:
    <form action="<?php echo home_url('/'); ?>make-appointments/" method="post" name="used_search" id="contactus" style="margin:5px 0 0 10px;" onsubmit=" return runFieldsCheck();" accept-charset="UTF-8" >
    That should resolve the issue and make the process more reliable.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Sep 2008
    Posts
    260
    Quote Originally Posted by rtrethewey View Post
    My advice would be to have your runFieldsCheck() function simply validate the user's entries
    Thanks for responding.

    The issue with that is I already have the server side language doing that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles