DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
390 stars 193 forks source link

SetList CheckBox value #73

Open matejkr opened 6 years ago

matejkr commented 6 years ago

There is an issue with setting CheckBox values from JSON array

myJson = '{"group-a":[{"text-input1":"1","text-input2":"27","checkBox":["on"]}]}';

All values to input get set normaly. CheckBox stays unsetted.

Regards

daywong1119 commented 6 years ago

I am having the same issue. @matejkr did you found the way out?

alainjlavoie commented 5 years ago

Same issue. Was this resolved? Work around? @matejkr @daywong1119 did you guys figure out a work around or the solution?

Thanks/Alain

pauljura commented 5 years ago

Hi, I had the same problem but solved it by setting an explicit "value" attribute on the checkbox, eg:

<input type="checkbox" name="checkBox" value="on">

Virelox commented 3 years ago

Anyone solved this?

paulayo93 commented 3 years ago

Please, did anyone get to solve this error? Thanks

bekanur98 commented 3 years ago

@paulayo93 I've solved this issue in my situation,

<div ....>
<input type="checkbox" name="payment[]" value="bank" >
<input type="checkbox" name="payment[]" value="cash" >
<input type="checkbox" name="payment[]" value="credit"> 

</div...>

$repeater.setList([
    {
       "payment" = ["bank", "cash"],
       ....
    },
)]

So after that my checkbox with value "bank" and "cash" wil be checked.