normally you would use the name rather than the id. for checkbox and radio you check if checked:
// handle checkbox, radio
if (id && (["radio","checkbox"].indexOf(element.type) < 0 || element.checked))
obj[id] = value;
// should really include disabled for full compatability
if (id && !element.disabled && (["radio","checkbox"].indexOf(element.type) < 0 || element.checked))
obj[id] = value;
Member
23 Points
157 Posts
How to convert data from a form to JSON
Jan 14, 2019 10:23 AM|slkim|LINK
I want to convert the Value of the radio button on the form to Json and save it as a file.
Can you tell me which part is the problem now that the last value is stored?
All-Star
57854 Points
15488 Posts
Re: How to convert data from a form to JSON
Jan 14, 2019 04:59 PM|bruce (sqlwork.com)|LINK
normally you would use the name rather than the id. for checkbox and radio you check if checked: