Friday, August 3, 2018

Radio button checkboxes values are not passing

Developer always encounter with HTML issues.

Some issues are so frustrating that we finally give up and try to find another alternative.

This problem is like that only but we do not need to consider another alternative what we need to do is set the default value if we did not get the parameter in the request.

Issue

After submitting form, if radio button or checkbox is not selected we are getting undefined index error because those parameters does not exists like they are not part of the form.

Solution

This is default property of radio button and checkboxes, if they are not selected then parameters are not passed, to overcome this, either make one value selected or check if parameter received or not, if not received then set the default value of that parameter in server side code.

Hope this helps and you get some relief.