addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [la-ruby] Looking for Rails/Javascript pattern ...

From: Alf M.
Sent on: Wednesday, September 16, 2009 2:55 PM
Andreas,

I did something like this with two related selection lists...basically I rendered the different possible selection lists to HTML strings and stored them in a JSON hash that I put into the page.? Then when the "parent" selection list was changed, it did a lookup in the hash and set the content for the child selection list.? The code for the project is open source, if you're interested in seeing it.? I hesitate to share this because it's an ugly view, but hopefully it will help you out.? Look for "updateStateInput"

??? http://github.com/amikula/promotego-org/blob/master/app/views/locations/_location_form.html.haml

-Alf


On Wed, Sep 16, 2009 at 2:13 PM, Andreas <[address removed]> wrote:
I am looking for some feedback on how to avoid a server round trip in the following situation:

A select-box establishes a parent/child relationship between groups and a subgroup when it is created - I'm using a collection_select.? There are some additional attributes from the active record that represents the parent that I need to dynamically set other screen elements in the same view (radiobuttons).

My plan is to use an observer field to trigger the action, but where do I keep the additional attributes that I need?? In a hidden field?

Or are there other options or helpers that I haven't discovered?? Is there any code somewhere that I could be looking at?

I would also like to know where to best keep the needed Javascript code.

Thank you Alf for your email that encouraged me (and hopefully others) to post.? Maybe I will be even able to answer some in the future.

Andreas







--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Andreas ([address removed]) from The Los Angeles Ruby/Rails Meetup Group.
To learn more about Andreas, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup Support: [address removed]
632 Broadway, New York, NY 10012 USA

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy