Actually, I can now answer my own question. I did not have the actual submission form ajaxified, just the couple of inputs. So it started working when I changed the form to <form ajax ...> . And after an if xhr then send to json in the controller, it works beautifully now.
On Tue, Apr 15, 2014 at 4:07 PM, Lea Viljanen <[email protected]> wrote: > I'm ajaxifying an older existing application and I'm having some > trouble with it. > > - I have a Registration page for an Event (tag new_for_event_page > for=Attendee), which collects a bunch of personal information (model > Attendee includes name, age_group, email etc) and some Event specific > information (meals etc). > > - I populate some information on this page based on the age group the > user selects from a drop down. I'm doing this with <hot-input ajax> > and later on the page using "<if > test="&this_parent.attendee.age_group" ..> to change the pricing on > the meal data. > > - The data is submitted to AttendeesController#create. If everything > is ok, I'm doing a redirect and if something goes wrong, I'm doing a > "render :new_for_event". > > This (and also an ajaxified update function) works fine if everything > is populated correctly. > > However, if the user does not give an email address (which is marked > :required and has a validation to make sure) things go south and I'm > getting a template error: > > "Showing controller: attendees; dryml-tag: new-for-event-page where > line #1 raised: > undefined method `age_group' for nil:NilClass" > > I'm assuming "render :new_for_event" is not right for the page with > Ajax functionality, something is obviously not passed right to the > template? It worked fine before ajaxifying, > > So how should I go about ensuring that on error conditions I'm getting > back a page with errors highlighted? -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/hobousers. For more options, visit https://groups.google.com/d/optout.
