开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜