Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 1.3: validation via xml stops on first error

 
Fran Cricket
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a form with some fields required. If I submit the form without specifying a value for all those fields, only the first message error is displayed. Moreover, if I set a value for that field and resubmit the form, the others fields aren't validated and the form is sent.

I tried to set property stopOnFirstError value to false in the struts-config.xml:

In the jsp in which there is the form I have

for each property required.

Bye,
Cri
 
manovemula vemula
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi....
In the validator.xml file you have to mention the form name and field property ,depends ,and the argument keys....


see for example is there username field is availabule you have to set the validation to that field like in the following

<form name="what ever your mentioned in the struts-config.xml file">
<field property="name of the property" depends="what are the validations you want to added the field"
<arg key="what is the message you have to disply wen the user not enter the data">
</field>

like this you have to mention validation for all the fileds,,,,,,,,,


EXample

<form name="userregistrationform">
<field property="username" depends="required,minlength,maxlength">
<arg key="username "resource="false"/>
<field>


 
Fran Cricket
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
manovemula vemula wrote:Hi....
In the validator.xml file you have to mention the form name and field property ,depends ,and the argument keys....


see for example is there username field is availabule you have to set the validation to that field like in the following

<form name="what ever your mentioned in the struts-config.xml file">
<field property="name of the property" depends="what are the validations you want to added the field"
<arg key="what is the message you have to disply wen the user not enter the data">
</field>

like this you have to mention validation for all the fileds,,,,,,,,,


EXample

<form name="userregistrationform">
<field property="username" depends="required,minlength,maxlength">
<arg key="username "resource="false"/>
<field>




Thank you for the example.
I used more than one form tag for the same form.
Now it works, but I have still some problems with validwhen and with properties required if a selection has a certain value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic