We have a form named Structural Systems that a user can use to inspect their home, we would like for all custom fields that don’t get selected or “inspected” to be required so that they are forced to pick one. This way something gets printed out when you see your inspection results after submitting.
Inspection form: hidden link
What is the link to your site? hidden link
You should have backend login credentials on file, please let me know if I need to provide them again.
Unfortunately i'm not able to see the form on the page.
However if you want to make the custom fields required then you can do it by going to Toolset -> Custom Fields and edit the field group that the custom fields belong to.
Once you've done that you can edit each of the custom fields and ensure that the required options are checked.
You will need login credentials to be able to view the form. Do you still have access to the backend? Christian was the former Support specialist that would help us out. Not sure if that will help?
I may not need the credentials at this stage as my instructions in the previous response should be able to assist you with getting your fields to be required.
If there are any issues with this please let me know.
We have looked into this and we still need your help. We are using the "checkboxes" custom field and we need the user to be forced to pick "inspected" or "not inspected" on all items. (Screenshot attached)
If at all possible, please log in and take a closer look. Your help is greatly appreciated.
I've added the following code to Toolset -> Settings -> Custom Code.
// Put the code of your snippet below this comment.
add_filter('cred_form_validate','my_validation',10,2);
function my_validation($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//uncomment this if you want to print the field values
//print_r($fields);
//validate if specific form
if ($form_data['id']==331)
{
//check if the user selected a Grading and Drainage value
if (empty($fields['wpcf-grading-and-drainage']['value']))
{
//set error message for Grading and Drainage
$errors['grading-and-drainage'] = 'No value selected';
}
}
//return result
return array($fields,$errors);
}
You form should now be checking if the user selects the field option.