• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to use DynaActionForm for the following?

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form which if the user contains no serial # a text box needs to appear. Which I have done now. My problem is that I am trying to validate the field. However it does not seem to get to the validation method which I have defined. Can this be done with org.apache.struts.action.DynaActionForm?
Im using <html:multibox in my jsp and that is why I am using DynaActionForm.

thank you all for your time

In my jsp I have the following

I have the following in the struts-config

In the validator-rules.xml I have

[ February 11, 2005: Message edited by: john mattucci ]
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is your entry for your validation.xml? The file that is used to state how forms are validated?

Best of Luck,

Nate
[ February 10, 2005: Message edited by: Nathan Hook ]
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have also tried to set the form to use org.apache.struts.validator.DynaValidatorActionForm, but the validation is never called. In validation.xml I defined the form

<form name="myTonesActionForm">
<field property="serialnumber"
 
Nathan Hook
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
does your validator.xml file look like the following?



Also, do you define the validator-rules.xml and validator.xml in your struts -config.xml file?



Finally, are you just checking to see if the registration number is present? Or are you checking it for a specific format?

Best of Luck,

Nate
[ February 10, 2005: Message edited by: Nathan Hook ]
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes to all questions. The page can either have a serial number text box if the user does not have a serial number or not if he does have one. So I cant use required since the field might not appear at times. But for now I even changed the field to required and it still does not validate
 
Nathan Hook
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, I might see part of the problem.

In your form, you have two attributes named newtones and oldtones.

Then in your validator.xml you are looking for a attribute named serialnumber.

All these values have to be named the same. If they arn't then you will run into problems. You should at least add the attribute serialnumber to your form. FYI, You don't have to have all the attributes of your form in the validator.xml.

Best of Luck,

Nate
[ February 10, 2005: Message edited by: Nathan Hook ]
 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No i dont have all my fields in the validator.xml only serial number. But serial number is only present some of the time in other words i cant mark it required. I created my own method in the validator-rules.xml. The problem im facing now is that this method is not even being called and even I mark the field as required in the validator.xml no error is shown it always goes directly to the action.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,

This is pertaining to another posting you did earlier. I am getting the same error. I tried your approach of rebuilding the project to remove any stale files. But that did not work. Did you do anything else??

Can you please reply to my post [b]IllegalArgumentException: argument type mismatch[b] posted on February 10, 2005 02:24 PM.

Any help appreciated.

Thanks.

Peter.

p.s. I tried to email you, but the mail bounced back.
 
catch it before it slithers away! Oh wait, it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic