Solved

onchange not working for Dynamic Selects in firefox

Posted on 2011-03-03
6
399 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now