__( 'Timed Submit', 'ninja-forms' ), 'edit_options' => array( array( 'type' => 'text', 'name' => 'label', 'label' => __( 'Label', 'ninja-forms' ), 'desc' => __( 'Submit button text after timer expires', 'ninja-forms' ), 'default' => __( 'Submit', 'ninja-forms' ), 'class' => 'widefat ninja-forms-field-label' ), array( 'type' => 'text', 'name' => 'timer-text', 'label' => __( 'Label', 'ninja-forms' ), 'default' => __( 'Please wait %n seconds', 'ninja-forms' ), 'desc' => __( '%n will be used to signify the number of seconds', 'ninja-forms' ), 'width' => 'wide', 'class' => 'widefat ninja-forms-field-label' ), array( 'type' => 'number', 'name' => 'countdown', 'label' => __( 'Number of seconds for countdown', 'ninja-forms' ), 'desc' => __( 'This is how long a user must wait to submit the form', 'ninja-forms' ), 'default' => 10, ), ), 'display_function' => 'ninja_forms_field_timed_submit_display', 'group' => 'standard_fields', 'edit_label' => false, 'edit_label_pos' => false, 'edit_req' => false, 'default_label' => __( 'Submit', 'ninja-forms' ), 'edit_desc' => false, 'edit_custom_class' => true, 'edit_help' => false, 'edit_meta' => false, 'sidebar' => 'template_fields', 'display_label' => false, 'edit_conditional' => true, 'conditional' => array( 'value' => array( 'type' => 'text', ), ), 'process_field' => false, 'pre_process' => 'ninja_forms_field_timed_submit_pre_process', 'limit' => 1, 'visible' => false ); ninja_forms_register_field('_timed_submit', $args); } add_action('init', 'ninja_forms_register_field_timed_submit'); function ninja_forms_field_timed_submit_display( $field_id, $data, $form_id = '' ){ $field_class = ninja_forms_get_field_class( $field_id, $form_id ); if(isset($data['timer-text']) AND $data['timer-text'] != ''){ $label = $data['timer-text']; }else{ $label = __( 'Please wait %n seconds', 'ninja-forms' ); } if(isset($data['countdown']) AND $data['countdown'] != ''){ $countdown = $data['countdown']; }else{ $countdown = '10'; } if(isset($data['label']) AND $data['label'] != ''){ $submit_text = $data['label']; }else{ $submit_text = __( 'Submit', 'ninja-forms' ); } $label = preg_replace( "/%n/", "" . $countdown . "", $label); ?> add_error('javascript-general', $javascript_error, 'general' ); } else { $timer = isset( $user_value['timer'] ) ? $user_value['timer'] : 10; if( intval( $timer ) > 0 ){ $ninja_forms_processing->add_error('timer-'.$field_id, $timed_submit_error, $field_id); } } }