MVC3 - How to remote validate on checkbox click?

583 views Asked by At

I am using the Remote Validation attribute on my domain model, to call an Action that returns Json. This validation occurs on a checkbox and it only kicks in when the form is submitted. I'd like it to act the same way that text boxes remote validation works. As soon as it looses focus, remote validation kick in. Or perhaps on click.

These are screen shots from a test project. The actual project is too busy, that's why I created this sample one.

I'd love to see some suggestions that do not involve using JQUERY in the view. But if that's the only way then be it.

Thank you.

MODEL:

Both properties have the same Remote validation, because I wanted to test if the loosing of focus would trigger the text box to validate, and indeed, it worked. I assumed that the same would happen for the check box, perhaps on click, or loosing focus, but no. Only when I click create the IsNameDuplicate() is called. enter image description here

CONTROLLER: enter image description here

VIEW: enter image description here

0

There are 0 answers