I need to write default action for the sel开发者_JS百科ection if user select "Please select" on dropdown menu on rails so how can I identify whether user have selected that??
The select helper generates an option tag with no specific value for the "Please select" entry. So the params hash gets assigned "Please select" for that param when you submit the form.
I'm not familiar with rails and how select boxes are handled, but in general html mark-up you could add attribute value="0" for the "Please select" element and later check for it. If the passed value is 0 you'll know that the user failed to select something from the select box.
精彩评论