views:

470

answers:

1

Hi there

I'm not sure if my issue is more general or only xVal specific.

At the moment I have a form with an undefined list of partial forms Something like this. There I load a partial form with Ajax, with xVal I attach also a validator.

My problem now is that the rendered form is not validated until a postback.

Is there any possibility to get validation work / run javascript on Ajax-requested forms?

Firefox validates the partial rendered form correctly, internet explorer is doing it after a postback.

Is it possible to validate ajax-rendered forms on client site with Internet Explorer?

I hope my problem is clear, if not I will provide some code, but I think it's not code-specific for now.

Regards

A: 

Are you using jquery.validate for client-side validation? If so, you could trigger validation manually upon an onchange event of the given field.

Have a look at the valid() and element() functions. The former tells you whether the field is currently marked as valid and the latter triggers validation for that field.

Adrian Grigore
HiYes, xVal is using jquery so do i :)The problem is that I get the partial form with ajax and in this form would be the Javascript that adds the validation to the fields.But Internet Explorer does not execute the Javascript in the Ajax Request.So the fields are not getting the validation info which would be processed by jquery.validate
griti
Try putting that code within a document.ready() function in the form partial view you are loading. If this should not work, you can always put it in a regular function and execute it yourself after the request completes.
Adrian Grigore
but which event do I have after the request completes? on the ActionLink onSuccess it's to early :-/
griti
Sorry, but I don't know anything about the ASP.NET AJAX package. I am using jQuery for all my AJAXing needs.
Adrian Grigore