Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stopping the struts validation for a particular non-displayed fields

 
chingh tangh
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 10 fields in a form and there are 2 fields that are being displayed sometimes.

I have written the struts validations for 10 fields. In the case of 2 fields not being displayed on the page, when I click on submit button, it throws browser error dialog.

a) Is there anyway to stop struts validating those two fields, when they are not present.
b) Can we pass any indicator to struts to stop doing the validation to that field.

Pls help.

Thx in advance.
 
Shankar Narayana
Ranch Hand
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which validation are you talking off, is it the validator or the validate method in ActionForm.
 
Anthony Watson
Ranch Hand
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might try making those form fields be present every time. You could make them invisible by making them html hidden fields or using style sheet settings. Hope that helps.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33697
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chingh,
I assume you are talking about the validator. I don't know any way of handling the fields not existing, but I can think of a workaround. You could create a hidden field with a valid value.
 
chingh tangh
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Validation is going through, when I kept as hidden fields.

Thanx very much for the reply.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic