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

Disable/Enable Validation

2 Answers 704 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Tommy
Top achievements
Rank 1
Tommy asked on 20 Jan 2015, 04:55 PM
I'm trying to disable and enable validation depending on the user selection. On my solution i would like to only validate if the user enters a start or end date. So far if you look at part of my solution code(copied to kendo ui dojo http://dojo.telerik.com/uyOHa )  i have some of the validation working. I will put down a couple of scenario on how i need it to work.

scenario 1(working)

User doesn't enter dates, Validation not needed

scenario 2(working)

User enters a start or end date. This will validate the text boxes.

scenario 3(NOT WORKING)

User enters start and end date. Click Search. Then Clear both date fields and validation is how showing for these two text boxes. I wish to have the validation hidden at this point. The only way i can do this so far is by clearing the text boxes then hitting search again.

Thanks in advance!

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 22 Jan 2015, 12:08 PM
Hello Tommy,

I am not sure if I understand the logic in the provided dojo. The example uses multiple validators initialized each time the button is clicked and check if the inputs have value only in the click handler. I updated the example to use an alternative approach with a single validator and a rule that checks the other input and then revalidates it if needed. Please check it and let me know if works for you.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Tommy
Top achievements
Rank 1
answered on 22 Jan 2015, 02:07 PM
Hi Daniel,

This makes more sense and it works now! Thanks a million!

Regards,

Tommy
Tags
Validation
Asked by
Tommy
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Tommy
Top achievements
Rank 1
Share this question
or