Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why this client side javascript is not enabled?

 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using validator framework, the server side validations are working fine and displaying error messages properly.

Now I want to eable client side validations and want to diplay error messages as popup alerts. For this I have done these things in my jsp..

First I have added this line:


I have also added 'onsubmit' to my form tag:


on top of the jsp in between html head tag I have added this entry:


Now the error messages are not getting displayed as popup alerts messages at client side.

Pls tell me what might be the problem ?

Thanks.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not have two <html:javaScript> tags in your JSP. Only one. The first one you listed should suffice.

Also, make sure hat you specify validate="true" in your Action mapping.
 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill,

Thanks for your reply.

As you suggested I have deleted the second <html:javascript> tag.
In my action mapping in struts-config.xml I am having the entry validate="true" .

Still its not working.

Pls suggest me in this regard.

Thanks.
 
David Dhune
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try putting <html:errors/> in your JSP

-- David
 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

Already I have written this in my JSP, still its not working.

what might be the problem?
 
David Dhune
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try following things, see if it works,

1. Use <html:javascript formName="BasicInfoActionForm"/> and remove the other one from your JSP.
2. On the browser, right click and do "View Source" and try to search validateBasicInfoActionForm, and see it exactly matches with the function name and crosscheck formName also, formName="BasicInfoActionForm".
3. If it still not works, you may try html:form

-- David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic