[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Javasript Autosubmit won't work in IE

Posted on 2009-05-01
2
Medium Priority
?
254 Views
Last Modified: 2013-12-08
I have a page that displays data from a database.  At the top of the page is a select box that allows you to sort the data various ways.  I don't want a submit button, just an onchange type event.  Right now, when you change the select box, it reloads the page with the sort.  But it will not work in IE.  Everything but IE works perfect.

Any ideas on how I can code this so that IE will auto submit as well?
<form method="POST" name="sortForm" id="sortForm" action="<?php $_SERVER['PHP_SELF'] ?>" onchange="javascript:document.sortForm.submit();"
   <b>Sort Order : </b>
   <select name="sort" id="sort">
      <option value="id" <?php if ($sort == "null"){ ?> SELECTED <?php } ?> >ID</option>
      <option value="stuName" <?php if ($sort == "stuName"){ ?> SELECTED <?php } ?> >Name</option>
      <option value="contEmail" <?php if ($sort == "contEmail"){ ?> SELECTED <?php } ?> >E-mail</option>
      <option value="loanSemester" <?php if ($sort == "loanSemester"){ ?> SELECTED <?php } ?> >Semester</option>
      <option value="status" <?php if ($sort == "status"){ ?> SELECTED <?php } ?> >Status</option>
   </select>
</form>

Open in new window

0
Comment
Question by:cbastian-hill
2 Comments
 
LVL 19

Accepted Solution

by:
LordOfPorts earned 2000 total points
ID: 24282809
Try moving the onchange event code from the FORM element to the SELECT element, this works in both browsers.
<form method="POST" name="sortForm" id="sortForm" action="<?php $_SERVER['PHP_SELF'] ?>">
   <b>Sort Order : </b>
   <select name="sort" id="sort" onchange="javascript:document.sortForm.submit();">
      <option value="id" <?php if ($sort == "null"){ ?> SELECTED <?php } ?> >ID</option>
      <option value="stuName" <?php if ($sort == "stuName"){ ?> SELECTED <?php } ?> >Name</option>
      <option value="contEmail" <?php if ($sort == "contEmail"){ ?> SELECTED <?php } ?> >E-mail</option>
      <option value="loanSemester" <?php if ($sort == "loanSemester"){ ?> SELECTED <?php } ?> >Semester</option>
      <option value="status" <?php if ($sort == "status"){ ?> SELECTED <?php } ?> >Status</option>
   </select>
</form>

Open in new window

0
 

Author Closing Comment

by:cbastian-hill
ID: 31577049
Solution made me feel like an idiot...:)  Can't believe I didn't think to try this.  Excellent seggestion, worked perfect...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
Several part series to implement Internet Explorer 11 Enterprise Mode
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
Suggested Courses

873 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