aspose file tools*
The moose likes Struts and the fly likes Dropdown always selects the first value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dropdown always selects the first value" Watch "Dropdown always selects the first value" New topic
Author

Dropdown always selects the first value

Nirmal singh Mehta
Greenhorn

Joined: Sep 08, 2012
Posts: 6
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

Joined: Jun 18, 2012
Posts: 12
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

Joined: Sep 08, 2012
Posts: 6
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

Joined: Aug 31, 2012
Posts: 47

You can use some jquery inside the on change event



hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dropdown always selects the first value