Exclude Empty Field
-
Is there a way we can exclude empty fields (the fields that are optional and the user hasn’t filled) from the submissions (from the email).
e.g If I have a form having text fields
* Your Height
* Your WeightLet’s say user fills
Your Height: 5’6
Your Weight: (empty)I want to receive the email as:
Your Height: 5’6But the Email I receive now is:
Your Height: 5’6
Your Weight:I hope you understand the problem.
I tried creating the filteradd_filter( 'ninja_forms_submit_data', 'my_ninja_forms_submit_data' ); function my_ninja_forms_submit_data( $form_data ) { foreach( $form_data[ 'fields' ] as $index => $field) { // Field settigns, including the field key and value. if($field['value'] == "") { unset($field[$index]); } } $form_settings = $form_data[ 'settings' ]; // Form settings. $extra_data = $form_data[ 'extra' ]; // Extra data included with the submission. return $form_data; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Exclude Empty Field’ is closed to new replies.