• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

DynaValidatorForm not allowing insert.

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having trouble inserting a form where at least one non-required input fields is left blank. Here's the general "flow" of the issue:

I have a simple Struts application that contains an insert screen that has 10 fields to be inserted into a database. The insert screen (jsp) is configured to use the DynaValidatorForm where only 5 of the 10 fields are marked "required" in the validator.xml file. All 10 fields are listed in the appropriate form bean in the struts-config.xml file. The validation works as expected when I leave one of the required fields blank. Also, when I fill out ALL the fields in the form, the data is inserted into the database as expected. However, I am not able to insert the form data when at least one of the non-required fields is blank. After clicking the insert button, the request is forwarded to the resource associated with the INPUT parameter of the appropriate action element in the strus-config.xml file. So it's failing validation on some level and I'm not sure how to get around it.

I would assume that DynaValidatorForm would allow blank values for non-required fields, but these blank fields are causing the form to fail validation.

Can someone point me to some resources that will help clarify this for me?

Thanks in advance,
Scott
 
Scott Updike
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about I rephrase my issue:

I have an insert form where I'm using the DynaValidatorForm to validate the input fields. Of the 10 input fields, only five are marked "Required" in my validation.xml file. The other 5 non-required fields are not listed in the validation.xml. All 10 fields are listed in my form-bean element in the struts-config.xml file.

The validation works just fine if I try and submit the form with a blank field in one of the required fields; however, when I try and submit the form where all the required fields are populated and one or more of the non-required fields are blank, the form returns with no error messages (i.e., returns to the file specified by the INPUT paramater in my action element).

So my question is, what could be preventing this form from passing validation? I assume it's failing, but on what?

What am I missing?

Thanks,
Scott
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Scott, but I cannot think what would cause this. Have you tried turning off validation for your action or removing the section from validation.xml? Maybe if you posted the relevant action mapping and validation rules it would help.

- Brent
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic