Hello @rocketpig3
There are different alternatives.
You can include a conditional operation as part of the equation. For example, assuming the equation is: fieldname1+fieldname2 and you want to return the result only if the user has populated the fields values. You can edit the equation as follows:
IF(AND(fieldname1,fieldname2), fieldname1+fieldname2, '')
Or you can validate the form from the calculate button, to prevent the evaluation of the equations if the values of form fields are invalid. Enter the following piece of code as the onclick event of calculate button:
if(jQuery(this.form).valid()){jQuery(this).addClass('calculate-button');}else{jQuery(this).removeClass('calculate-button');}
and that’s all.
Best regards.
Thanks @codepeople.
So if I wanted to use option one, but include an error message like “Please fill out all required fields”, I would have to have this as an HTML field and then show it based on the IF statement, is that correct? Or is there a better way of doing it?
Thanks.
Hello @rocketpig3
You are free to implement the behavior you want, for example, you can insert a “HTML Content” field or an “Instruct. Text” field with the message, and then, in the settings of calculated field, define a dependency like: If value is equal to 0, and
select the field with the message from the list of dependent fields (https://cff.dwbooster.com/documentation#dependencies)
Best regards.
OK @codepeople that makes sense.
Is it possible to make radio select fields display a red “This field is required” notice when not filled in?
On my form, this message will appear when I have not selected one of the checkboxes in the checkbox field, but leaving the radio selects blank will not force the form to print a message, even though they are required and have the asterisk.
I have tried unchecking “Allow untick choices” but this has not worked.
Thanks.
Hello @rocketpig3
Q: Is it possible to make radio select fields display a red “This field is required” notice when not filled in?
A: The message is displayed when the form is being submitted or the field loses the focus without ticking any choice.
By the way, if you want all validation rules be evaluated immediately after the form loaded to display all error messages.
– Insert a “HTML Content” field in the form, with the following piece of code as its content:
<script>
fbuilderjQuery(document).one('showHideDepEvet', function(){
fbuilderjQuery('[id*="cp_calculatedfieldsf_pform_"]').valid();
});
</script>
and that’s all.
Best regards.
A: The message is displayed when the form is being submitted or the field loses the focus without ticking any choice.
This does not occur for my radio select fields unfortunately, even with that HTML field script in use.
Do you mind if I email you the URL?
Hello @rocketpig3
If you prefer, you can contact me through my private website: Contact Us
Best regards.