On Jan 31, 2010, at 1:04 PM, Ralph Shnelvar wrote:
>
> Steve Ross wrote:
>> On Jan 31, 2010, at 11:48 AM, Ralph Shnelvar wrote:
>>>
>>> I have a list of fields in a form that need to be validated against a
>>> database.
>>>
>>> I would prefer to have the validation occur every time the field loses
>>> focus (onblur event) rather than when the user does a submit.
>>>
>>> Does anyone know of an RoR example of how to do that?
>>
>>
>> jQuery validate?
>>
>> http://docs.jquery.com/Plugins/Validation
>
> I think the jQuery validate function I want is "remote".
>
> Is there any way for that function to call a RoR action in a model or
> controller rather than more php or javascript?
Here's some old code I pulled off the shelf...uses jq validate
var validator = $("#new_user").validate({
rules: {
"user[login]": {
required: true,
minlength: 3,
remote: "/users/login_taken"
}
}
});
Pardon the abysmal formatting.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.