Tuesday 15 September 2015

Why is Rails resetting user selected times when there are unrelated validation errors? -


I have this code that allows the user to click on date to show the second row to specify the date is. The screenshot user has been entered in two dates:

  & lt; Fieldet class = "date_fieldset" & gt; & Lt;% = f.label: user_event_date, "date", category: "info_inline_control info_label"% & gt; & Lt;% = f.text_field: user_event_date, category: 'calendar'% & gt; & Lt; Div class = "user_event_inline_container margin_left_ten padding_right_gone" & gt; & Lt;% = f.label: start_time, "start", category: 'info_inline_control info_label five_margin_right'% & gt; & Lt;% = f.time_select: start_time, {: ampm = & gt; True}, class: (field_clas (@user_evant, start_time) + 'info_inline_control')%> & Lt; / Div & gt; & Lt; Div class = "user_event_inline_container margin_left_ten padding_right_gone" & gt; & Lt;% = f.label: end_time, "end", category: 'info_inline_control info_label five_margin_right'% & gt; & Lt;% = f.time_select: end_time, {: ampm = & gt; True}, class: (field_class (@user_evant, and_time) + 'info_inline_control')%> & Lt; / Div & gt; & Lt;% = f.hidden_field: _destroy% & gt; & Lt;% = link_to "Delete", '#', Category: 'remove_fields margin_left_ten'% & gt; & Lt; / Fieldset & gt; & Lt; Script type = "text / javascript" & gt; $ (Function () {$ ('datepicker'). Date picture ({dateFormat: "dd-mm-yy"}}}};    

entered in two dates and is okay

But if some other, non-related elsewhere The field on the form is an authentication error, and if errors are reported at the top of the format, then the user has gone two rows to the specified dates, and the click date button creates the user clicks on the dates To start re-assigning, how can I pause the page refresh users to show validation errors for the selected dates?

 User Selected Dates

Create new, edit, and admin action methods here:

  DIF New If! Sign-in? Redirect_to signin_path left @user_event = UserEvent.new @ user_event.event_dates.build end-of-end DEF edit end DEF @user_event = current_us Er.user_events.build (parameter [: user_event]) If @ user_event.save flash [: success] = "The event was successfully posted! "Redirect_to root_url render another action: new end end   

As always, thank you very much for your answer in advance

This fixes it:

  
< P> Before that, I had a blank box, and every time an event was clicked on the JavaScript add date link I But when the page has been provided again, either due to verification errors, or else because the incident is being edited, div needs to be pre-f.fields_for.

Man I love rail, and community, because I get pieces of the puzzle, and understand the rest.

No comments:

Post a Comment