Hi all,

I got it working!

I had to add a validate="true" attribute on the <s:form/>. With that added,
the form was trying to make an AJAX request onblur. But I got a JS error in
FB:
    element.form.attributes['name'] is undefined.
Debugging a bit, I figured that the JS figures out the validation action to
invoke on the server from the name attribute of the form. I gave the form a
name (name="myform"). Now the AJAX request was made, but DWR was throwing up
some errors on the server-side.
    SEVERE: Error while trying to validate
    There is no Action mapped for action name myform. - [unknown location]
True, there is no action with the name 'myform'. I changed the name of the
form to the action name as it all started working as expected!
    <s:form method="post" theme="ajax" validate="true" name="show">
        <s:textfield label="Name" name="name"/>
        <s:textfield label="Age" name="age"/>
        <s:submit value="Submit"/>
    </s:form>

I copied the evaluated JSP into an HTML page, and debugged it. I was able to
remove all JS errors in FB by:
    1) Commenting out a <script language="JavaScript" type="text/javascript"
src="/validations/struts/simple/dojoRequire.js"></script> added by
the<s:head theme="ajax"/> tag.
    2) Commenting out a dojo.require("dojo.widget.html.Tooltip") line added
by, I think, the <s:form/> tag. I think Dojo guys have renamed the widget to
dojo.widget.Tooltip since 0.3.

With these changes, I was able to remove every JS error in FB. I now get
some Dojo deprection warnings though.
    DEBUG: DEPRECATED: dojo.style replaced by dojo.html.style -- will be
removed in version: 0.5
    DEBUG: DEPRECATED: dojo.animation.AnimationEvent is slated for removal
in 0.5; use dojo.lfx.* instead. 0.5
    DEBUG: DEPRECATED: dojo.animation.Animation is slated for removal in
0.5; use dojo.lfx.* instead. 0.5
    DEBUG: DEPRECATED: dojo.animation.AnimationSequence is slated for
removal in 0.5; use dojo.lfx.* instead. 0.5
    DEBUG: DEPRECATED: dojo.Animation.* is slated for removal in 0.5; use
dojo.lfx.* instead. 0.5
    DEBUG: DEPRECATED: dojo.graphics.color.Color is now
dojo.gfx.color.Color. 0.5

Thanks,
Binil


Binil Thomas wrote:
> 
> Hi Musachy,
> 
> Thanks for replying!
> 
> On FB I see HTTP 404s on:
> 1) http://localhost:8080/validations/stuts/dojo/src/widget/html/Tooltip.js
> 2) http://localhost:8080/validations/stuts/dojo/src/widget/html.js
> 3) http://localhost:8080/validations/stuts/dojo/src/widget.js
> 4) http://localhost:8080/validations/stuts/dojo/src/__package__.js
> 5) http://localhost:8080/validations/stuts/dojo/src.js
> 6) http://localhost:8080/validations/stuts/dojo/__package__.js
> 
> Also, on both FB and the page, I see the error:
> Could not load 'dojo.widget.html.Tooltip'; last tried '__package__.js'
> (I have enabled Dojo debug now). I think the Dojo widget is called
> dojo.widget.Tooltip.
> 
> When the form first shows up I see the field error message for 'name'
> field. When I fill out the field and tab out of it, no AJAX request is
> send to the server (I am assuming that the expectation is that the form
> gets validated at the server via an AJAX call onBlur).
> 
> When I click submit, an AJAX request is send and the server responds with
> the HTML page for the action; but nothing happens to the page.
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-the-AJAX-Form-Validations-to-work-tf3390223.html#a9449588
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to