You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a group of radios uses "true" or "false" for their values, form2js converts these to boolean true and false. However, if you add a 3rd radio to the group to indicate "none selected" or "no answer" or "any" and set its value to "", form2js will convert the checked radio with a value of "" to boolean false. However, if you don't use "true" and "false" as the values, the "" value works as expected.
This is because of the radio case in getFieldValue, which falls-through to the checkbox case. The offending line from the checkbox case is:
This is correct for checkboxes, but for something like:
any
on
off
It is broken. I should not get back boolean false if the "any" radio is checked. I should get back "". To fix this, i just copied the statements from the checkbox case in getFieldValue, excluding the offending line, to the radio case.
Point is, this feels like a bug or maybe just unexpected behavior. IMHO, getFieldValue should not treat a radio just like a checkbox.
The text was updated successfully, but these errors were encountered:
When a group of radios uses "true" or "false" for their values, form2js converts these to boolean true and false. However, if you add a 3rd radio to the group to indicate "none selected" or "no answer" or "any" and set its value to "", form2js will convert the checked radio with a value of "" to boolean false. However, if you don't use "true" and "false" as the values, the "" value works as expected.
This is because of the radio case in getFieldValue, which falls-through to the checkbox case. The offending line from the checkbox case is:
if(!fieldNode.checked && fieldNode.value === "true") return false;
This is correct for checkboxes, but for something like:
any
on
off
It is broken. I should not get back boolean false if the "any" radio is checked. I should get back "". To fix this, i just copied the statements from the checkbox case in getFieldValue, excluding the offending line, to the radio case.
Point is, this feels like a bug or maybe just unexpected behavior. IMHO, getFieldValue should not treat a radio just like a checkbox.
The text was updated successfully, but these errors were encountered: