Solved

onchange not working for Dynamic Selects in firefox

Posted on 2011-03-03
6
407 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ajax "mind reader" script 11 362
AJAX post submit actions 6 267
GridMvc Error mvc5 5 232
Problem with small jquery script 6 54
The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
A lot of things can happen during a presentation, worst of which is “death by PowerPoint.” Here are a few mistakes to avoid to make your slides clean.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 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