Backbone.ModelBinder icon indicating copy to clipboard operation
Backbone.ModelBinder copied to clipboard

If called copyViewValuesToModel the radio button with checked attribute in html gets checked and model gets the value.

Open technikhil314 opened this issue 10 years ago • 3 comments

I had written html with a group of radio buttons, in which I had added checked attribute to first radio button to make it checked by default when view is rendered. On the same form on change event of another element I had called copyViewValuesToModel function.After adding the call I find that the radio which had checked attribute gets checked though if I had changed the selection in radio button group.On debugging I found on line 303 of backbone.modelbinder.js the code is if(el.attr('type') === 'radio' && el.attr('checked')) which should be if(el.attr('type') === 'radio' && el.is(':checked')). Correct me if I am wrong.

technikhil314 avatar Jan 24 '15 14:01 technikhil314

Hi @nikhil-001mehta,

I would favor el.prop('checked') myself, but I agree that el.attr('checked') seems fishy/off there. If you get a chance, would you mind seeing if using prop will work too?

Did you want to open a pull request to fix this, or would you like me or someone else to do so?

platinumazure avatar Feb 09 '15 02:02 platinumazure

Hi @platinumazure

I yes the prop is working.so I will open a pull request soon.

technikhil314 avatar Feb 10 '15 07:02 technikhil314

this seems to have been fixed

amakhrov avatar Aug 08 '15 06:08 amakhrov