Show custom message in Response Error Alert
-
Hello, I activate custom code the user can submit only once per day, but I need to show the error message in popup alert that shows above, this code
add_filter( 'forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ) { $form_ids = array(869); $alert_ms = 'alert'; $message = 'You cannot submit more than 1 time within 24 hours.'; if ( in_array( intval( $form_id ), $form_ids, true ) ) { $user_ip = Forminator_Geo::get_user_ip(); if ( ! empty( $user_ip ) ) { $last_entry = Forminator_Form_Entry_Model::get_last_entry_by_ip_and_form( $form_id, $user_ip ); if ( ! empty( $last_entry ) ) { $entry = Forminator_API::get_entry( $form_id, $last_entry ); $current_time = strtotime( date( 'Y-m-d H:i:s' ) ); $future_time = strtotime( '+1 day', strtotime( $entry->date_created_sql ) ); if ( $current_time < $future_time ) { $submit_errors[][$alert_ms] = $message; } } } } return $submit_errors; }, 15, 3 );
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show custom message in Response Error Alert’ is closed to new replies.