File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes client side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "client side validation" Watch "client side validation" New topic
Author

client side validation

Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hi
i am doing client side validations i have made all necessary changes in my project in jsp i have included

In my validation.xml i have defined all validation
validator.xml is also updated

Message Resources all 3 files

my action class & form class are also changed but still on running my form
it shows me following error

No form found under 'userLoginForm' in locale 'en_US'. A form must be defined in the Commons Validator configuration when dynamicJavascript="true" is set.

Please help

thanks in advance
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Aditi agarwal wrote:hi
i am doing client side validations i have made all necessary changes in my project in jsp i have included

In my validation.xml i have defined all validation
validator.xml is also updated

Message Resources all 3 files

my action class & form class are also changed but still on running my form
it shows me following error

No form found under 'userLoginForm' in locale 'en_US'. A form must be defined in the Commons Validator configuration when dynamicJavascript="true" is set.

Please help

thanks in advance


Hi Aditi

just change here
onsubmit="validateUserLoginForm(this);

shiva
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks Shiva for your reply

but i have read in all tutorials that it need to be same as that of formbean type

still as you said i have changed it but of no effect

thanks
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Aditi agarwal wrote:thanks Shiva for your reply

but i have read in all tutorials that it need to be same as that of formbean type

still as you said i have changed it but of no effect

thanks


Hey ...
make sure that form class is extends validatorForm and in validation.xml check the formname <form name="xxxx"> should be same in struts-config.xml
and <html:javascript formName="xxxx" />

<html:form action="/ yyyy.do " onsubmit="validatexxxx(this);">
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks again shiva ut it is still not working

if you say then i will put my all validation related files over here

thank you
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Aditi agarwal wrote:thanks again shiva ut it is still not working

if you say then i will put my all validation related files over here

thank you



yes you can post your struts-config.xml,validation.xml,form class and jsp
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
userLogin.jsp


struts-onfig.xml



validations.xml




validator-rules.xml



userLoginForm.java


thank you
waiting for your reply
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
hi aditi.

move <html:javascript formName="userLoginForm"> tag in <head>

and change this <html:form action="/userLogin" onsubmit="validateUserLoginForm(this); ">
to <html:form action="/userLogin" onsubmit="validateuserLoginForm(this); ">

its working ...
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey thanks shiva for your prompt reply

now atleast error is not coming my page is running but the validations are not working now

please give some more suggestions

thanks once again
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Aditi agarwal wrote:hey thanks shiva for your prompt reply

now atleast error is not coming my page is running but the validations are not working now

please give some more suggestions

thanks once again


hi aditi.....
it has to work..
check this onces
<html:form action="/userLogin" onsubmit="return validateuserLoginForm(this);">

after changing the above line .run the jsp and check the generated source code in the browser of the userLogin.
you can find the generated javascript.
if it is coming means javascript is working..
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hi shiva its not working actually i have entered a data in my db that


username : jointsecm
passwd : js@341

here@ is not allowed but its excepting it is not showing any validation

thanks

looking forward for your reply
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hi shiva its not working actually i have entered a data in my db that


username : jointsecm
passwd : js@341

here@ is not allowed but its excepting it is not showing any validation

thanks

looking forward for your reply
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
atleast at my home when i give

<html:javascript formName="userLoginForm"/>

is not giving any error & not validating at all but at my office it gives me same error

help me anyone
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
please give me any solution
shiva ram kumar
Greenhorn

Joined: Dec 16, 2009
Posts: 12
Aditi agarwal wrote:please give me any solution



Hi aditi

did you kept this inside <head> tag

<html:form action="/userLogin" onsubmit="return validateuserLoginForm(this);">

</head>

onces it is done . run the jsp in the browser. ie or mozilla.

after that check viewsource of your jsp .
you can find the generated javascript ..
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hi shiva
thanks once again

are you sure i have to put <html:form> in tag as it is giving me warning

instead i have put<htm:javascript> complete tag in the <head> but of no use


ok tell me one thing is it working fine with you hve you checked that

if yes then please paste the code which is working correctly

& also do i need to add any library file for this in my project

guide me for that too

thank you
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: client side validation