spivurno
11/25/2015 - 10:42 PM

GP Copy Cat // Gravity Perks // Disable Conditional Logic on Submission

GP Copy Cat // Gravity Perks // Disable Conditional Logic on Submission

/**
 * GP Copy Cat // Gravity Perks // Disable Conditional Logic on Submission
 * http://gravitywiz.com/
 *
 * This snippet allows you to copy a field value to a field that is hidden via conditional logic by disabling conditional
 * logic for those fields when the form is submitted. Gravity Forms will then capture the submitted values for these inputs.
 */
// update "1117" to your form ID
add_filter( 'gform_pre_submission_filter_1117', function( $form ) {

	// update this array with a comma-delimited list of field IDs
	$disable_conditional_logic_fields = array( 2 );

	foreach( $form['fields'] as &$field ) {
		if( in_array( $field->id, $disable_conditional_logic_fields ) ) {
			$field->conditionalLogic = false;
		}
	}

	return $form;
} );