I finally figured out why the rules were not generated. The page has 2 columns, left column with the list of entities, right column with the template to view/modify the selected entity from the left column.
When the user clicks on one entity from left column, it is loaded by an ajax call in the right column for editing. When the use clicks on a "New" button, the template is prepared for adding a new entity. Because the action was "List" there was only the code to initialize the collection and not the possible new entity. So, for the record, something like this is needed for the rules to be generated: PropertyBag["entity"] = new Entity(); Somehow I was looking from far too close to this issue, to notice the problem. (Although, I think the rules should be generated even when the action is run through an ajax call.) On Jan 26, 10:10 pm, bdaniel7 <[email protected]> wrote: > I was able to reproduce the issue, I'm not sure if the behaviour is by > design or a bug. > > When the action is executed normally, with layout, the jQuery rules > are generated. > When the layout is cancelled, for an ajax action, the rules are not > generated. > > rules are generated: > > [AjaxAction] > public void NewRegion () > { > PropertyBag["region"] = new Region(); > } > > rules are not generated: > > [AjaxAction] > public void New() > { > PropertyBag["region"] = new Region(); > CancelLayout(); > RenderSharedView( "/regions/edit_region"); > } > > On Jan 26, 11:33 am, bdaniel7 <[email protected]> wrote: > > > Hello, > > > A while ago (pre 2.0) the validation attributes placed on a model were > > expressed as jQuery validation rules at runtime. > > Example from an older project: > > > jQuery( document ).ready( function() > > { jQuery("#register").validate( {messages: > > {"user.DeliveryAddress.City":{ required: "This is a required > > field." } }} ); > > > But in a 2.0 version, those attributes are no longer generated as > > jQuery validation rules. > > Example from current project: > > > jQuery( document ).ready( function() > > { jQuery("#region").validate( {} ); > > > Is this a bug? > > Where should I look to see what changed? > > Has anyone encountered this problem as well? > > > Thanks, > > Daniel -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en.
