Dropdown Field not shown error message

Kaur Navneet asked on September 10, 2024 13:56

Hi guys, In Kentico 13, I have created a kentico13 form with form builder and added Checkbox, Multiple choice, input field and Dropdown fields and all fields are required. when submit the form without filling all fields show error message but Dropdown field not shown error with field-validation-valid and they submit without select option.

Is there any specific setting for this where we can change the behavior of this.

<div class="editing-form-control-nested-control">
<select class="form-control WatermarkText" data-ktc-notobserved-element="" id="form-Testform-f646_DropDown_SelectedValue" name="form-Testform-f646.DropDown.SelectedValue" placeholder="Test form *">
<option selected="selected">option</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
<div class="field-validation-valid" data-valmsg-for="form-Testform-f646.DropDown.SelectedValue" data-valmsg-replace="true"></div><div class="field-validation-valid" data-valmsg-for="form-Testform-f646.DropDown" data-valmsg-replace="true"></div>
</div>

Recent Answers


Michael Solidum answered on September 11, 2024 20:36

In Kentico 13, if your dropdown field is not showing an error message when left unselected, even though it is marked as required, you might need to ensure a few things:

Validation Rules in Kentico: Verify that the dropdown field is properly set as required in the Kentico Form Builder. Sometimes, required field settings might not translate correctly into the frontend validation. Ensure that the "Required" property is enabled for the dropdown field in the form settings.

Default Option: Ensure that the default option in your dropdown () does not count as a valid choice. It might be useful to change this to a non-selectable placeholder like . This way, users will have to select a valid option from the dropdown, rather than just submitting with the default option.

Client-Side Validation: Check if client-side validation scripts are properly included and functioning on your page. Kentico forms usually use jQuery Validation for client-side validation. Ensure that your page includes the necessary scripts and that they are working correctly.

Form Configuration: Make sure there are no custom scripts or configurations overriding the default validation behavior for dropdown fields. Custom JavaScript might inadvertently bypass or disable validation.

Validation Message Placeholder: Ensure that the field-validation-valid div is correctly associated with your dropdown field. The data-valmsg-for attribute should match the name attribute of the dropdown field. If there’s a mismatch or if the validation message is not appearing, it might be due to incorrect or missing configuration.

You might need to test these adjustments and see if the validation behavior changes. If issues persist, checking the Kentico documentation or reaching out to Kentico support could also provide more tailored guidance.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.