Meaningless Drivel is fun!
The moose likes Struts and the fly likes DynaValidatorForm not allowing insert. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DynaValidatorForm not allowing insert." Watch "DynaValidatorForm not allowing insert." New topic

DynaValidatorForm not allowing insert.

Scott Updike
Ranch Hand

Joined: Feb 16, 2006
Posts: 92
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 Updike
Ranch Hand

Joined: Feb 16, 2006
Posts: 92
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?

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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
I agree. Here's the link:
subject: DynaValidatorForm not allowing insert.
jQuery in Action, 3rd edition