Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dropdown always selects the first value

 
Nirmal singh Mehta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP::

<select id="form_city" name="form" onchange=''return filterChange();''>
<option value="All">View All</option>
<option value="1">General</option>
<option value="0">Proposed</option>
</select>

function filterChange(){

document.forms["form"].submit();

}


In the front end, irrespective of what i have selected in the dropdown, it always takes "All" as selected and when submit the form "All" value goes to action every time. Please help
 
john Dalton
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before submit button write a script to set a value to ALL and then submit the form in next line by submit.form();
 
Nirmal singh Mehta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is already happening from my current code and i want only the selected from the dropdown to go to my action class. Please help
 
Ankit Dan
Ranch Hand
Posts: 47
Eclipse IDE Java MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use some jquery inside the on change event



hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic