This is a migrated thread and some comments may be shown as answers.

RadComboBox with Required Field Validator - IE issues when clearing with X

2 Answers 127 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 14 Mar 2016, 02:47 PM

Hello,

I have a RadComboBox with an associated required field validator. On Internet Explorer 11 (maybe other versions) an X appears that allows the user to clear the Combo. Please see the attached image if you don't know what I mean.

If the user clears the selection with the X and then clicks elsewhere (on another control for example) then the required field validator for the RadComboBox will activate. I only want this validator (and the other validators) to fire when the page is posted back.

There are a couple of the approaches that I have investigated but couldn't make get to work 100% correctly for various reasons are

1. Disable the validator temporarily with Javascript and re-enable later on. As per this thread Radcombobox clearSelection causes validation.
2. Use a custom validator.

The second one isn't really an option because the RadComboBox is used in an .ascx file that is re-used in a lot of places. Also, some attributes that are specific to a RequiredFieldValidator are required.

So, I am asking if there is a simple low impact way of preventing the validator from firing in this scenario?

Thanks in advance,
John.

2 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 14 Mar 2016, 03:14 PM
Posting the image now.
0
Veselin Tsvetanov
Telerik team
answered on 17 Mar 2016, 09:09 AM
Hi John,

Clicking the 'X' sign should clear the text from the input field. However it does not apply changes to the selection in the RadComboBox control. As you can see in the below video, after clearing the input field and performing postback, the selected item remains and the validation does not fail:
http://screencast.com/t/DXhRvhSwP86c

You could consult the following articles to learn how to enable / disable RequiredFieldValidatior:
Enable/Disable Required field validator from cs page?
Disabling/enabling requiredFieldValidators with javascript and server side

Regards,
Veselin Tsvetanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ComboBox
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or