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

shared custom rules?

3 Answers 57 Views
Validation
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 03 Jan 2013, 11:34 AM
hi,
is it possible to trigger a custom rule for 2 input fields?
for example i have 2 fields which are dependant on each other.  1 or the other is required.  but both can't not be empty.

how would i do this?

cheers

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 04 Jan 2013, 12:17 PM
Hello David,

Each custom rule will be run for each element in the validator form (docs). In other words you cannot run custom rule for two input fields at once - the rule will be triggered for each of them separately. If your requirement is to compare two fields, please select the other field with jQuery and check whether it is empty.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 04 Jan 2013, 04:14 PM
yes - thats possible - but doesn't remove the validation error.
there are tricks to get around that i guess if its not possible such as forcing a hide + or trigging blur() on the fields i wish to validate
0
Accepted
Alexander Valchev
Telerik team
answered on 08 Jan 2013, 09:31 AM
Hello David,

The validation messages can be hidden through jQuery hide method. For more information please check this forum topic.

To select a specific message, you may use it's data-for attribute. As an example:
$("span.k-tooltip-validation[data-for='inputName']");


Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Validation
Asked by
David
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
David
Top achievements
Rank 1
Share this question
or