Update view after insert

Hi i'm trying to update a select box with a newly created record, the
problem is that to create this record i open a popup window.

How can I update the select box with the record information created in
the popup window, is there a way to observer model changes and updates
the view based on that changes?

Please I really need help on this, I read a lot of forum and articles
and i could not find anything.

Thanks in advance

You need a remote_form (ie AJAX) that updates the element in the
(named) original form of the window that calls the popup.

Just to make perfectly clear, you need to set the html NAME and ID
property of the form tag on the page that calls the pop-up window,
because the pop up window has to reference inside of that form to
update the select tag.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

Daniel Waite wrote:

Are you trying to update the select field without reloading the page? If
so, you'll need to use JavaScript.

I recommend jQuery (http://jquery.com), but Rails comes with Prototype
(http://prototypejs.org).

If you have nil experience with JavaScript and you're pressed for time
(or are impatient) I recommend forgoing the Ajax experience and
reloading the page.

Hope that helps, if not, respond with more information. :slight_smile:

Yes i'm trying to update the select field without reloading the page.
I'll check the prototype

Julian Leviston wrote:

You need a remote_form (ie AJAX) that updates the element in the
(named) original form of the window that calls the popup.

Just to make perfectly clear, you need to set the html NAME and ID
property of the form tag on the page that calls the pop-up window,
because the pop up window has to reference inside of that form to
update the select tag.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

Sorry to bother you with this, but can you send me an example of how to
do this?

Thank ypu very much

Not unless you're prepared to pay me to do it, unfortunately.

I may release a video on how to do it sometime.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/