• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 420
  • Last Modified:

onchange not working for Dynamic Selects in firefox

Hello,

I am using the following code for dynamic selects in my php applicacation using Smarty Templates:

<form action="/php/Contact-Display.php" method="post" name="filter" id="filter" onsubmit="document.getElementById('return_rows').value=document.getElementById('rowsSelect').value;">

<select name="leadsourceFilter" id="LeadSourceId" onchange="document.getElementById('filterKey').value=this.id; document.getElementById('filterValue').value=this.value; document.getElementById('search').value=''; document.getElementById('current').value='0'; document.forms.filter.submit();">
                    <option value="">Select</option>
                   
                     
  {if $filterKey=="LeadSourceId"}{html_options values=$leadSourceIds output=$leadSourceNames selected=$filterValue}{else}{html_options values=$leadSourceIds output=$leadSourceNames}{/if}
                   
                  </select>
0
jkoonsman
Asked:
jkoonsman
  • 4
  • 2
2 Solutions
 
Gurvinder Pal SinghCommented:
try onclick along with onchange
0
 
jkoonsmanAuthor Commented:
Thank you for your quick response:

Not sure I am following you, how do you use them together?
0
 
Gurvinder Pal SinghCommented:
<select name="leadsourceFilter" id="LeadSourceId" onclick="onchangeFunction(this)">

<script>
  var lastValue = ""; //save the last value in this variable
  function onchangeFunction(thisObj)
  {
      if (thisObj.value != lastValue)
      {
      document.getElementById('filterKey').value=thisObj.id;
      document.getElementById('filterValue').value=thisObj.value;  
      document.getElementById('search').value='';
      document.getElementById('current').value='0';
      document.forms.filter.submit();
      }
  }
</script>
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
jkoonsmanAuthor Commented:
Sorry but I tried this and it worked one time in IE then could not reselect. It did not work at all in FF.

Thank you.
0
 
jkoonsmanAuthor Commented:
I think I am going to try and rewrite this with jquery.

Thanks for your help!
0
 
jkoonsmanAuthor Commented:
I am going to try ajax vs javascript.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now