aspose file tools*
The moose likes Struts and the fly likes Stopping the struts validation for a particular non-displayed fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Stopping the struts validation for a particular non-displayed fields" Watch "Stopping the struts validation for a particular non-displayed fields" New topic
Author

Stopping the struts validation for a particular non-displayed fields

chingh tangh
Greenhorn

Joined: Apr 06, 2004
Posts: 11
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

Joined: Jan 08, 2003
Posts: 134
which validation are you talking off, is it the validator or the validate method in ActionForm.


"Failure is not when you fall down; its only when you fail to get up again."
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
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.


Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
chingh tangh
Greenhorn

Joined: Apr 06, 2004
Posts: 11
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
 
subject: Stopping the struts validation for a particular non-displayed fields
 
Similar Threads
struts validator. stoping on first validation error.
Bypass client-side struts validation
Struts 1.1: html:radio issues
Validator not picking up error message resources
Regarding "html: reset " button