views:

82

answers:

0

I have been migrating a site from MVC1 to MVC2 for the last couple days. We chose to use the Jquery client-side validation.

At one point my BeginForm statement looked like this ...

 <% using (Html.BeginForm("Index", "Trial")) { %>

... and everything was working well.

Then I changed my BeginForm to use a strongly-typed variant:

 <% using (Html.BeginForm<TrialController>(action => action.Index())) { %>

When I switched to this my client-side validation stopped working and the form would post to the server. Firebug told me the culprit was a Javascript error related to the form ID. When I looked at the source I noticed the metadata with the validation rules no longer contained the FormId:

"FormId":null

When I use the older style BeginForm the FormId in the metadata is:

"FormId":"form0"

Is there a trick to get getting the FormId to not be null when using the strongly-typed BeginForm? Is anyone else even getting this behavior?