From 7048da3211eaa1f832afe8e796a0f0e5013b9251 Mon Sep 17 00:00:00 2001 From: Ranjan Date: Tue, 12 Dec 2023 12:11:32 +0545 Subject: [PATCH] Fix - Server side error display below Textarea Field --- assets/js/frontend/user-registration.js | 18 ++++++++++++++---- includes/form/class-ur-form-field-text.php | 2 +- includes/form/class-ur-form-field-textarea.php | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/js/frontend/user-registration.js b/assets/js/frontend/user-registration.js index 5c7f5b1af..98a7657ff 100644 --- a/assets/js/frontend/user-registration.js +++ b/assets/js/frontend/user-registration.js @@ -131,11 +131,15 @@ ) { var checkedValues = []; - field.each(function() { + field.each(function () { if ($(this).is(":checked")) { - var label = $(this).siblings('label').text(); + var label = $(this) + .siblings("label") + .text(); var value = $(this).val(); - checkedValues.push(label + ':' + value); + checkedValues.push( + label + ":" + value + ); } }); var field_value_json = @@ -144,7 +148,6 @@ var field_value_json = JSON.stringify(field_value); } - } else if (field_type == "radio") { var field_value_json = field_value[0]; } else { @@ -776,6 +779,7 @@ var response = JSON.parse( ajax_response.responseText ); + var timeout = response.data .redirect_timeout ? response.data @@ -1068,6 +1072,7 @@ '">' + value + ""; + var wrapper = $this .find( @@ -1075,6 +1080,8 @@ ) .find( "input[id='" + + index + + "'], textarea[id='" + index + "']" ); @@ -1463,6 +1470,7 @@ $field_id.push($id); } ); + $.each( response.data.message, function (index, value) { @@ -1493,6 +1501,8 @@ ) .find( "input[id='" + + index + + "'], textarea[id='" + index + "']" ); diff --git a/includes/form/class-ur-form-field-text.php b/includes/form/class-ur-form-field-text.php index 44c5515f0..9a8614543 100644 --- a/includes/form/class-ur-form-field-text.php +++ b/includes/form/class-ur-form-field-text.php @@ -71,7 +71,7 @@ public function validation( $single_form_field, $form_data, $filter_hook, $form_ // Custom Field Validation here.. $value = isset( $form_data->value ) ? $form_data->value : ''; - $label = $single_form_field->general_setting->label; + $label = $single_form_field->general_setting->field_name; // Validate Limit Length. if ( isset( $single_form_field->advance_setting->limit_length ) && $single_form_field->advance_setting->limit_length ) { diff --git a/includes/form/class-ur-form-field-textarea.php b/includes/form/class-ur-form-field-textarea.php index 1b416bbb1..94540b652 100644 --- a/includes/form/class-ur-form-field-textarea.php +++ b/includes/form/class-ur-form-field-textarea.php @@ -70,7 +70,7 @@ public function get_registered_admin_fields() { public function validation( $single_form_field, $form_data, $filter_hook, $form_id ) { $value = isset( $form_data->value ) ? $form_data->value : ''; - $label = $single_form_field->general_setting->label; + $label = $single_form_field->general_setting->field_name; // Validate Limit Length. if ( isset( $single_form_field->advance_setting->limit_length ) && $single_form_field->advance_setting->limit_length ) {