Thursday, 15 July 2010

In rails, how to save multiple UI fields to one nested attribute? -


When a user clicks AddDate in my Event Planning app, I add a line below so that the user can add a date and / End time, and AM / PM.

But in my form using nested attributes, it seems that my selected controls require references for those model fields (: start_time and: end_time). But start and end times are made from two selection controls, one hour and one minute. So I'm not sure the values ​​selected in the two selections will be added as the start and end times.

screenshot

  & 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.select: start_time, options_for_select ([['1'], ['2', 2], ['3', 3], ['4', 4], ['5' 5], '[' 6 ''], ['7', 7], ['8', 8], ['9', 9], ['10', 10], ['11', 11] [ '12', 12]]), class (Fild_cls (@ Ughr_ivent ,: Prarnb_taim + 'info_inline_control')% & gt; & Lt;% = f.select: start_time, options_for_select ([[ '00', 1 ], [ '15', 2], [ '30', 3], [ '45', 4]]), class: (Field_class (@ Yusr_ivent ,: start_time) + 'info_inline_control')% & gt; & Lt ;% = f.select: start_am_pm, options_for_select ([( 'am', 1], [ 'pm', 2]]), square (Fild_cls (@ Ughr_ivent ,: start_am_pm) + 'info_inline_control')% & gt; & Lt; / div & gt; & Lt; div class = "user_event_inline_container margin_left_ten padding_right_gone" & gt; & Lt;% = f.label: end_time, "end", class: 'info_inline_control info_label five_margin_right'% & gt; & Lt ;% = F.select: end_time, options_for_select ([['1', 1], ['2', 2], ['3', 3], ['4', 4], ['5' 5], [ ['11', 11], '[' 12 '], [' 12 ',' '6'], ['7', 7], ['8', 8], ['9', 9] , 12]]), Category: (field_class (@user_event, and_time) + 'info_inline_control')% & gt; & Lt;% = f.select: end_time, options_for_select ([[ '00', 1], [ '15', 2], [ '30', 3], [ '45', 4]]), class: (Field_class (@User_Evolution ,: and_time) + 'info_inline_control')%> & Lt;% = f.select: end_am_pm, options_for_select ([( 'am', 1], [ 'pm', 2]]), square (Fild_clos (@ Ughr_ivent, And_am_pm) + 'info_inline_control')% & gt ; & Lt; / div & gt;    

Why not use time_select instead ?

No comments:

Post a Comment