Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

onchange not working for Dynamic Selects in firefox

Posted on 2011-03-03
6
Medium Priority
?
412 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:Gurvinder Pal Singh
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:Gurvinder Pal Singh
Gurvinder Pal Singh earned 1000 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
Technology Partners: 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

WooCommerce is becoming the most powerful e-commerce plugin for Wordpress. And why not. The platform comprises of numerous core plugins that may come in handy, powerful options to make your website development task much easier.
What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 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