Solved

onchange not working for Dynamic Selects in firefox

Posted on 2011-03-03
6
404 Views
Last Modified: 2012-05-11
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
Comment
Question by:jkoonsman
  • 4
  • 2
6 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 35028337
try onclick along with onchange
0
 

Author Comment

by:jkoonsman
ID: 35028996
Thank you for your quick response:

Not sure I am following you, how do you use them together?
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 250 total points
ID: 35029611
<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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:jkoonsman
ID: 35032694
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
 

Accepted Solution

by:
jkoonsman earned 0 total points
ID: 35039986
I think I am going to try and rewrite this with jquery.

Thanks for your help!
0
 

Author Closing Comment

by:jkoonsman
ID: 35081161
I am going to try ajax vs javascript.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

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

Suggested Solutions

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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