Saving user selection from HTML shortcode to database
-
I’m using the following code to save the contents of my HTML element into my hidden field. However, clicking Submit on the form only submits the shortcode itself (
{filter_cm_tooltip_parse}) to the database and not the selected value of the select field generated in the shortcode?// Render shortcode on HTML fields add_filter( 'forminator_replace_variables', 'do_shortcode' ); // Include shortcode output to hidden field add_filter( 'forminator_custom_form_submit_field_data', function( $field_data_array ){ $form = array( 'field' => 'hidden-1', // Form hidden field 'shortcode' => '{filter_cm_tooltip_parse}' // Shortcode to be rendered ); foreach( $field_data_array as &$field_single ){ if( $field_single['name'] === $form['field'] ){ $field_single['value'] = strip_tags( do_shortcode( $form['shortcode'] ) ); } } return $field_data_array; });
The topic ‘Saving user selection from HTML shortcode to database’ is closed to new replies.