Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation problem with Struts1.2

 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The following validation is working with my old struts.jsr file. If I replace with Srruts1.2, validation fails any idea please.

<form name="/login">
<field property="userName" depends="required" >
<arg0 key="Heloo User Name please" resource="false"/>
</field>
<field property="password" depends="required" >
<arg0 key="Heloo Password please" resource="false"/>
</field>
</form>

Could some one explain how to validate a dropdown if defult value is "Select".(User must select other than "Select" from the dropdown)

Thanks
Sudhakar
 
Vicky Mohan
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if this is the best possible solution, but you can have the value as empty space for SELECT option. Now, having a validation rule as REQUIRED might trigger an alert message.

Hope this helps you.
 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay,

I have this in validation.xml and value for the "Select" made as empty, then validation started working but not sure how

Is there any other way without taking out the value ?

<field property="selectbox" depends="requiredif">
<arg0 key="Heloo select dorpdown please" resource="false"/>
<var>
<var-name>test</var-name>
<var-value>((selectbox == null) or (*this* == "Select"))</var-value>
</var>
</field>

Thanks
Sudhakar
 
martin jose
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sudhakar,

My struts1.2 validation is working perfectly, but we don't have any plugin support for struts1.2 in eclipse. So I have to do the validation in struts1.1 itself. I am not getting any help for 1.1 validation. I am doing the same thing in both, but only 1.2 is working. In 1.1 it is simply ignoring the validation. Is there any difference in validation.xml entries. Please give me some tips.

Thanks in advance
Martin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic