开发者

Rails 3 select and onchange without Ajax

I am struggling a whole day with the idea, how to build simple form that contains only select item. This select item will be contains 3 or 4 static values.

I don't know, how to make this form -- I need that after select the it开发者_如何转开发em from select offer will the form sent to controller for an action.

I tried to search and reading a lot of articles, but unfortunately I can't find working solution... I don't need an Ajax, just basic functionality.

I would ask you for help, how to do this simple form... Thank you, M.


add an onclick handler to the select that calls a method that simply submits the form.

Use this method to create the select:

collection_select(method, collection, value_method, text_method, options = {}, html_options = {})

In the html_options hash put in :onclick => "some_javascript_method()"

in your javascript method have it submit the form. I would suggest using jQuery to get the form element to call submit on.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜