aspose file tools*
The moose likes Struts and the fly likes null values diplays in 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 "null values diplays in Client Side Validation" Watch "null values diplays in Client Side Validation" New topic
Author

null values diplays in Client Side Validation

Praveen Reddy
Ranch Hand

Joined: Jul 12, 2006
Posts: 51
hi
i am getting one problem while using java script validations from validator frame work. I am giving validation to all field. while giving alert message when user not entered any values it displays "null is required" for all the fields, but we want to display particular field name is required(Ex. User Name is required).

my validate.xml form is
<formset>
<form name="CustomerFormMediator">

<field property="userName" depends="required">
<argo name="required" key="User Name" resource="false"/>
</field>
<field property="email" depends="required">
<argo name="required" key="email" resource="false"/>
</field>
</form>
</formset>

my jsp form is as follows

<b>username:</b> <html:text property="userName"/><br>
<b>email:</b> <html:text property="email"/><br>

please try to find my mistake i tried very much but i failed...please help me

Thanking you in advance.
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
key attribute of argX is suppose to be an entry in struts application resource property. I see "User Name" which can't be a valid key as it contains a blank space. Check this URL to get clear idea of client-side validation .
http://www.roseindia.net/struts/address_struts_validator.shtml
[ September 07, 2006: Message edited by: Purushothaman Thambu ]
Praveen Reddy
Ranch Hand

Joined: Jul 12, 2006
Posts: 51
Thanks for your reply Purushothaman

the way which you said also tried but i am getting same errors"null is required"

my validate.xml form is
<formset>
<form name="CustomerFormMediator">

<field property="userName" depends="required">
<argo name="required" key="userName" resource="false"/>
</field>
<field property="email" depends="required">
<argo name="required" key="email" resource="false"/>
</field>
</form>
</formset>

my jsp form is as follows

<b>username:</b> <html:text property="userName"/><br>
<b>email:</b> <html:text property="email"/><br>
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
You missed the crux of the previous message. What do you have in message resource bundle? Struts is not able to map the key value "userName" to any entry in the resource file.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: null values diplays in Client Side Validation