Oh of course! Should've struck me sooner! yeah a partial is an HTML fragment as you put it :).. usually one you will use multiple times. My 2 cents worth :)
On Thu, Jan 8, 2009 at 5:17 PM, T.J. Crowder <[email protected]> wrote: > > Hi, > > I'm guessing by "partial" you mean an HTML fragment? Then yes, you > can easily do that with Ajax.Updater[1]. > > [1] http://prototypejs.org/api/ajax/updater > -- > T.J. Crowder > tj / crowder software / com > Independent Software Engineer (consulting services available) > > On Jan 8, 11:46 am, Ram <[email protected]> wrote: > > Hi T.J.Crowder, > > > > I read through that thread. I dont really need to dynamically add form > > fields. Rails and RJS make it fairly simple enough. I was just > > wondering if it is possible to pass a partial to Element.insert as the > > new HTML element. The partial will just display dynamic data. It wont > > display form fields. > > > > On Jan 8, 4:30 pm, "T.J. Crowder" <[email protected]> wrote: > > > > > Hi Ram, > > > > > I can't address the Rails side of this question (never having used > > > Rails), but you can do this easily enough on the client side. > > > > > As it happens, this question of adding form elements dynamically just > > > came up in this group yesterday: > http://groups.google.com/group/prototype-scriptaculous/browse_thread/... > > > > > Element#insert won't work (reliably) for form fields because it uses > > > innerHTML, which doesn't quite work correctly on all browsers for form > > > fields. (It does for everything else, AFAIK.) So you have to do DOM > > > stuff instead (which Prototype makes easier in a variety of ways); see > > > the linked discussion above for details. > > > > > HTH, > > > -- > > > T.J. Crowder > > > tj / crowder software / com > > > Independent Software Engineer (consulting services available) > > > > > On Jan 8, 5:36 am, Ram <[email protected]> wrote: > > > > > > I have various select boxes for currencies on a page. These can be > > > > dynamically added via JS too. As and when the user selects > currencies, > > > > i need another separate div called "test_currencies" to get updated > > > > with the currency name and the total amount in that particular > > > > currency (which requires some DB info and calculation). > > > > Im on Rails so im thinking of putting this info in a partial and > > > > rendering that partial into $("test_currencies").bottom whenever > > > > there's a selection made. > > > > If the user chooses a previously chosen currency, the info for that > > > > currency is updated and re-rendered into "test_currencies". If > > > > instead, a new currency is chosen, a new partial carrying the info > for > > > > THAT currency needs to be rendered into $("test_currencies").bottom. > > > > Thus, the "test_currencies" div should carry all the chosen > currencies > > > > and the aggregate amounts in those currencies. I tried this > > > > > > Am i approaching this requirement correctly? Can it be done this way > > > > using Prototype? Or should I be using RJS for this? > > > > Hope someone can guide me on this. > > > > > > > -- In Sport We Trust !!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
