This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation issue

 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am calling a logon form as shown below in the struts config file...



Since I have given validate="true", the page load with errors (empty/null errors for required check). I would like to load the form first, ie w/o checking the errors. And want to validate on submit of the form rather than on load.

Could anyone pl point out where is the mistake I am making...?

[ June 14, 2007: Message edited by: Bhaskar Reddy ]
[ June 14, 2007: Message edited by: Bhaskar Reddy ]
 
Zip Ped
Ranch Hand
Posts: 336
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Override the validate method in your Form bean and check for first time and second time requests by passing some parameter.

You can return null from you validate method on first time entry.
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply!

I am extending the ValidatorForm and using the struts built-in validations. I want to avoid writing the validation logic in the ActionForm.

Is there any other workaround for this?
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have now tried using validator method check for a hidden field (firstTimeFlg) value in the logonForm as follows :

But this field is not recognized in the Form's validate method...

Could someone pls tell me why is the hidden field in a form not recognized in the Form's validate method?
 
Zip Ped
Ranch Hand
Posts: 336
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the code for your LoginForm?

Also, did you try to retrieve the value of the hidden field through the request parameter?
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
post the code. I believe validate refers to inputs and no hidden
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kailash,

I could resolve the issue... I think I was not getting it from the request object!!!

below code works!



Thank you for your valuable input.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic