Forminator: how to create hidden hash field
-
Hi,
My site is using Forminator.
I need to calculate the hash of another field {text-1} as a new field that will be saved. I looked into calculation fields, but they only accept numerical values, and won’t have the hash256 I need.
I tried creating my own Forminator Add-On, adding a filter (inspired from this post https://wordpress.org/support/topic/how-to-get-wordpress-post-id-from-forminator-form-not-page-id/) to override the value of my new field {calculation-1} with the correct php calculation, but it’s not working.
See code below.
Is there a document that explains the flow of forminator ?add_filter( 'forminator_bqeth_form_override_hash', function( $submit_errors, $form_id, $field_data_array ) { $text1 = ''; var_dump($field_data_array); foreach( $field_data_array as $field ) { if ( ! isset( $field[ 'name' ] ) || ! isset( $field[ 'value' ] )|| $isbn_field !== $field[ 'name' ] ) { continue; } if ( isset( $field[ 'name' ] ) && $field['name'] == 'text-1') { $text1 = $field['value']; } } foreach( $field_data_array as $field ) { if ( ! isset( $field[ 'name' ] ) || ! isset( $field[ 'value' ] )|| $isbn_field !== $field[ 'name' ] ) { continue; } if ( isset( $field[ 'name' ] ) && $field['name'] == 'calculation-1') { $field['value'] = hash('sha256', $text1, true); } } return $submit_errors; }, 20, 3 );The page I need help with: [log in to see the link]
The topic ‘Forminator: how to create hidden hash field’ is closed to new replies.