Sequential Numbers in form
-
Hii Sir,
I want to generate sequential numbers in forminator form but I was unable to create. I am using below code but not working for me.
add_filter( 'forminator_custom_form_submit_field_data', function( $field_data_array, $form_id ){ // We're using a custom macro <code>AUTOINCREMENT_INT</code> set as value for a field. // Make sure you add this value only in hidden fields $needle = 'AUTOINCREMENT_INT'; $incremental = get_post_meta( $form_id, 'autoincrement_int', true ); $update_meta = false; foreach ( $field_data_array as $key => $field_data ) { if ( isset( $field_data[ 'value' ] ) && $needle == $field_data[ 'value' ] ) { if ( ! $incremental ) { $incremental = 1; } else { $incremental++; } echo "<script>console.log('Debug Objects: " . $incremental . "' );</script>"; $field_data_array[$key][ 'value' ] = $incremental; $update_meta = true; } } if ( $update_meta ) { update_post_meta( $form_id, 'autoincrement_int', $incremental ); } return $field_data_array; }, 20, 2 );
Please review the code and help me.
Thanks and Regards,
Raghav
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Sequential Numbers in form’ is closed to new replies.