Can the checkboxes field type can be made to NULL if none of the options is selected for a filed For example: I have four checkboxes for a field in my form and initially one was checked later all were unchecked can the field be made NULL?
Solved! Go to Solution.
Add a checkbox with the literal string value NULL.
Hide it by default:
.mktoForm .mktoCheckboxList input[value="NULL"],
.mktoForm .mktoCheckboxList input[value="NULL"] + label {
display: none;
}
If the value is empty on submit, then flip it to NULL.
MktoForms2.whenReady(function(readyForm){
readyForm.onSubmit(function(submittingForm){
const currentValues = submittingForm.getValues();
if(currentValues.MyInterestingField == "") {
submittingForm.setValeus({
MyInterestingField : "NULL"
});
});
});
});
Presumably meaning the Checkboxes type?
Add a checkbox with the literal string value NULL.
Hide it by default:
.mktoForm .mktoCheckboxList input[value="NULL"],
.mktoForm .mktoCheckboxList input[value="NULL"] + label {
display: none;
}
If the value is empty on submit, then flip it to NULL.
MktoForms2.whenReady(function(readyForm){
readyForm.onSubmit(function(submittingForm){
const currentValues = submittingForm.getValues();
if(currentValues.MyInterestingField == "") {
submittingForm.setValeus({
MyInterestingField : "NULL"
});
});
});
});
Love this. Another way: if you would rather use OOTB capabilities, you could use a Change Data Value flowstep that triggers on form fill, create a choice that says IF none of the fields contain any of the checkbox values then make the field NULL.
Well, no.
The goal is to empty the field if the person didn’t check off any of the visible fields, because otherwise the field will be left with its old value.
Your flow choice is saying “if it’s already empty, empty it.” It won’t have any any effect.
Hi Sanford,
I had my developers implement this script but it doesn't appear to work