File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DynaValidatorForm not allowing insert." Watch "DynaValidatorForm not allowing insert." New topic
Author

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
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?

Thanks,
Scott
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: http://aspose.com/file-tools
 
subject: DynaValidatorForm not allowing insert.
 
Similar Threads
How to generate a jsp page with form in struts where input values are pre-generated?
how to create input fields dynamically in struts
Struts Validation for non formdata
Still not working - DynaValidatorActionForm and checkboxes
DynaValidatorForm question: