Sets or gets the value of the selected option.
Setting the value
property sets the Option
with that value to be the selected option. You must set the value
property to a value that exists in the options
list.
To reset the radio button group to have no option
selected, set the value
property to null
or undefined
.
Getting the value
property returns the value of
the currently selected option. If no value is selected, the
value
property returns an empty string.
Notes:
Changing a radio button group's value
in code does not trigger an onChange
event.
If a radio button group is connected to a dataset, setting the radio button group's value
in code does not set the value of the connected field in the dataset.
That means if you use the dataset to perform a submit, the value changed
in code is not reflected in the submitted item.
To submit the new value using a dataset, set the field's value using the
setFieldValue()
function before
performing the submit.