• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Stopping the struts validation for a particular non-displayed fields

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which validation are you talking off, is it the validator or the validate method in ActionForm.
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Validation is going through, when I kept as hidden fields.

Thanx very much for the reply.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic