html - play framework Multiple forms with checkbox fields with the same name attribute -


i have form have multiple smaller forms inside it. smaller forms have same type of fields. have 2 checkbox fields in each of smaller forms name= "timeoftheday". 1 checkbox has value "morning". other 1 has value "evening". forms name "timeoftheday" same, 1 value out of forms getting selected. 1 selection done @ time in overall form field.

also cant change name of field as, in play model, using same model forms, mapping name.

please suggest solution this.

my main model:

public class details {     //default customers     public string timeoftheday;      public integer cost;      public string day;      //customized details each customers     public customform customdetails[]; } 

customform is:

public class customform {     public string timeoftheday;      public integer cost; } 

defaultform template:

//these params sending while rendering file controllers @(id: long, detailsform : form[models.settings.details], isedit: boolean)  <div class="col-md-2 text-left min-size-label removepadding">   <span>day</span> </div>  <div class="col-md-10 removepaddingleft">   @input(detailsform("day"), 'class -> "form-control col-xs-12 formfield ") </div>  <div class="col-md-2 text-left min-size-label removepadding">   <span>cost</span> </div>  <div class="col-md-10 removepaddingleft">   @input(detailsform("cost"), 'class -> "form-control col-xs-12 formfield ") </div>                    <div class="col-md-10 text-left min-size-label removepadding">   <span><b>time of day</b></span> </div>  <div class="col-sm-12">   @inputradiogroup(     detailsform("timeoftheday"),     options(enums.timeofdayenum.timeofdaymap()),     'name -> "timeoftheday",     'class -> "timeoftheday"   ) </div> 

customform template:

@(id: long, customdetailsform : form[models.settings.customform], isedit: boolean)  <div class="col-md-2 text-left min-size-label removepadding">   <span>cost</span> </div>  <div class="col-md-10 removepaddingleft">   @input(customdetailsform("cost"), 'class -> "form-control col-xs-12 formfield ") </div>  <div class="col-md-10 text-left min-size-label removepadding">   <span><b>time of day</b></span> </div>  //options fetched enums <div class="col-sm-12">   @inputradiogroup(     customdetailsform("timeoftheday"),     options(enums.timeofdayenum.timeofdaymap()),     'name -> "timeoftheday",     'class -> "timeoftheday"   ) </div> 

both forms have same timeoftheday named radio button field. can have many customform in single page. have same name using same model. how make selection each of forms individually.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -