开发者

In dropdown menu When we add values from database what is the id that comes to "Please select" selection?

开发者 https://www.devze.com 2023-04-05 14:42 出处:网络
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 gener

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号