struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maksim Bartenev <>
Subject Re: ReferenceError: validateForm struts 2
Date Mon, 04 May 2009 23:41:48 GMT

The cause of the bug seems to be a regex `regexInvalid` in BindDev.js,
which cuts out references to djConfig when concatenating together all
<script> contents. This causes scripts that register widgets to become
syntactically invalid and break the script evaluation thus not
allowing generated validation function (also glued into the combined
script) to be registered by the browser.

The simplest work around is to turn on content parsing to allow dojo
to autodetect widgets from markup. This, however should be done on the
page level with a <sx:head parseContents="true" /> tag to prevent
"pushId" scripts from being generated by sx:tags. However placing this
tag on asynchronously loaded pages seems to break things, as scripts
attempt to include dojo every time the page is requested by ajax.
So after digging in dojo plugin sources a bit I came up with the
following solution. I placed

<s:set name="struts.dojo.head.parseContent" value="%{ true }"></s:set>

in the page to be fetched by ajax, thus canceling "pushId" scripts
generation and that was enough to make client validation operational.

Off course, for any of the in the downloaded html to be properly
detected by dojo, parseContent should be enabled on the div that is
used as the container for loaded data.

> Hi all!
> I got this error: ReferenceError: validateForm_frmExcl is not defined  when
> a form to be validated is inside a <sx:tabbedPanel> <sx:div>
> I read some solutions that Musashi and Jeromy wrote about this, but I still
> getting the error..
> Includding that there's a new attribute (separateScripts) into struts 2.1
> dojo tags to resolve this.
> I tried to put this attribute and executeScripts="true" inside all related
> dojo tags, but the error persists.
> Here's some screens:
> Page with a list:
> Same page with error:
> By the way... Is that possible to take out this blue/purple border from
> TabbedPanel?
> I changed the templateCssPath but it doesn't changed the border.
> Tanks so much!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message