I am developing rails 3 application (I am newbie in Rails).
Currently, I have a form (use “form_for“) for submit, there is a div area under the form. What I want is when user click the ‘submit‘ button of the form, based on the user input data in the form, application will first go to the database to retrieve and organize some data, then the div area under the form will be rendered with the organized data.
That’s the content of the div area is rendered dynamically based on user’s input in the form, and the div render happens when user click “submit” form button .
The index.html.haml:
=form_for :myform do |form|
= ...
= ...
=form.submit "submit"
%div.result
/dynamic content to be rendered here, when user submit the form
=render :partial 'result'
I think my form submission should first go to run a controller method to organize the data from Database, and what’s the next step I should do? As you noticed from the above code, I have a partial there under div, I would like to update the ‘result‘ partial when user submit form, but how to implement this??
examples of how you may update your page in response to ajax polling