Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread Mike Kienenberger
Sgarlata Matt <[EMAIL PROTECTED]> wrote:
> I'm having some trouble using the maxlength validation and I was hoping 
> someone could give me some help.  I have a form with one required field 
> and one field with a maximum length of 2000 characters.  When input 
> validation fails for both fields I get the following messages (text in 
> parentheses I added):
> 
> Bin Name is required. (good!)
> null can not be greater than 2000 characters.  (not good)
> 
>  property="description"
>  depends="maxlength">
>  
>  
>  
>maxlength
>2000
>  
>


That looks like it should work to me.   I started with maxlength and created 
my own "length" function.  The only difference I see is that I use "key, 
name, resource" and you're using "name, key, resource." [And yes, my mask 
validator is probably redundant.]

 




length
3


mask
^[0-9][0-9][0-9]$

 

David Graham <[EMAIL PROTECTED]> wrote:
> Try:
> 
> 
> The number after "arg" is the position in the message to replace so you
> need a 0.

Since his output was "null can not be greater than 2000 characters.", that 
would simply create "2000 can not be greater than 2000 characters."

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread Sgarlata Matt
David Graham wrote:
That's correct, the default is true.  Maybe it's broken when you don't
provide a name attribute?
I agree; I will add this info to BugZilla.

Thanks again for all your help.

David
Matt

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread David Graham
--- Sgarlata Matt <[EMAIL PROTECTED]> wrote:
> David Graham wrote:
> > I'm confused by your setup:
> > 
> 
> Yeah, I was trying random stuff.  The final thing that worked was:
> 
> property="description"
>depends="maxlength">
>
>
>
>  maxlength
>  2000
>
> 
> 
> I think this is a bug 
> (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23034) because 
> resource="true" should not be required, right?

That's correct, the default is true.  Maybe it's broken when you don't
provide a name attribute?

> 
> > The name attribute should be the name of the relevant validation rule
> > listed in the depends clause.  You only have maxlength in depends and
> > fieldname isn't a Struts validation.
> 
> Good to know.
> 
> > What happens when you do this?
> > 
> 
> Interesting, that works too.  So the complete  element is:
> 
> property="description"
>depends="maxlength">
>
>
>
>  maxlength
>  2000
>
> 

That's the correct way to setup the validation.

> 
> Is the name attribute required?  It isn't needed for the required check.

No, it's not required.  If not provided, the key will be shared in that
position for all validation messages.

David

> 
> Matt
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread Sgarlata Matt
David Graham wrote:
I'm confused by your setup:

Yeah, I was trying random stuff.  The final thing that worked was:


  
  
  
maxlength
2000
  

I think this is a bug 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23034) because 
resource="true" should not be required, right?

The name attribute should be the name of the relevant validation rule
listed in the depends clause.  You only have maxlength in depends and
fieldname isn't a Struts validation.
Good to know.

What happens when you do this?

Interesting, that works too.  So the complete  element is:


  
  
  
maxlength
2000
  

Is the name attribute required?  It isn't needed for the required check.

David
Matt

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread David Graham
--- Sgarlata Matt <[EMAIL PROTECTED]> wrote:
> Ah-hah, figured it out.  This will not work:
> 
> 
> 
> but this will work:
> 
> 
> 
> I will enter this as a bug, because the documentation states that "By 
> default the arg0-arg3 elements will try to look up the key attribute in 
> the message resources" at
> 
> http://jakarta.apache.org/struts/userGuide/dev_validator.html

I'm confused by your setup:


The name attribute should be the name of the relevant validation rule
listed in the depends clause.  You only have maxlength in depends and
fieldname isn't a Struts validation.

What happens when you do this?


David



> 
> Thanks for your help Mike & David,
> 
> Matt
> 
> Mike Kienenberger wrote:
> 
> > Sgarlata Matt <[EMAIL PROTECTED]> wrote:
> > 
> >>I'm having some trouble using the maxlength validation and I was
> hoping 
> >>someone could give me some help.  I have a form with one required
> field 
> >>and one field with a maximum length of 2000 characters.  When input 
> >>validation fails for both fields I get the following messages (text in
> 
> >>parentheses I added):
> >>
> >>Bin Name is required. (good!)
> >>null can not be greater than 2000 characters.  (not good)
> >>
> >>>> property="description"
> >> depends="maxlength">
> >> 
> >>  resource="false"/>
> >> 
> >>   maxlength
> >>   2000
> >> 
> >>   
> > 
> > 
> > 
> > That looks like it should work to me.   I started with maxlength and
> created 
> > my own "length" function.  The only difference I see is that I use
> "key, 
> > name, resource" and you're using "name, key, resource." [And yes, my
> mask 
> > validator is probably redundant.]
> > 
> >   > property="socialSecurityNumberA"
> > depends="required,length,positiveNumber,mask">
> > 
> > 
> > 
> > 
> > length
> > 3
> > 
> > 
> > mask
> > ^[0-9][0-9][0-9]$
> > 
> >  
> > 
> > David Graham <[EMAIL PROTECTED]> wrote:
> > 
> >>Try:
> >>
> >>
> >>The number after "arg" is the position in the message to replace so
> you
> >>need a 0.
> > 
> > 
> > Since his output was "null can not be greater than 2000 characters.",
> that 
> > would simply create "2000 can not be greater than 2000 characters."
> 
> -- 
> Matthew Sgarlata
> Senior Consultant
> Booz Allen Hamilton Inc.
> Work: 703-377-0871
> Fax: 703-902-3608
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread Sgarlata Matt
Ah-hah, figured it out.  This will not work:



but this will work:



I will enter this as a bug, because the documentation states that "By 
default the arg0-arg3 elements will try to look up the key attribute in 
the message resources" at

http://jakarta.apache.org/struts/userGuide/dev_validator.html

Thanks for your help Mike & David,

Matt

Mike Kienenberger wrote:

Sgarlata Matt <[EMAIL PROTECTED]> wrote:

I'm having some trouble using the maxlength validation and I was hoping 
someone could give me some help.  I have a form with one required field 
and one field with a maximum length of 2000 characters.  When input 
validation fails for both fields I get the following messages (text in 
parentheses I added):

Bin Name is required. (good!)
null can not be greater than 2000 characters.  (not good)
  



  maxlength
  2000

  


That looks like it should work to me.   I started with maxlength and created 
my own "length" function.  The only difference I see is that I use "key, 
name, resource" and you're using "name, key, resource." [And yes, my mask 
validator is probably redundant.]

 




length
3


mask
^[0-9][0-9][0-9]$

 
David Graham <[EMAIL PROTECTED]> wrote:

Try:

The number after "arg" is the position in the message to replace so you
need a 0.


Since his output was "null can not be greater than 2000 characters.", that 
would simply create "2000 can not be greater than 2000 characters."
--
Matthew Sgarlata
Senior Consultant
Booz Allen Hamilton Inc.
Work: 703-377-0871
Fax: 703-902-3608
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread David Graham
Try:


The number after "arg" is the position in the message to replace so you
need a 0.

David

--- Sgarlata Matt <[EMAIL PROTECTED]> wrote:
> I'm having some trouble using the maxlength validation and I was hoping 
> someone could give me some help.  I have a form with one required field 
> and one field with a maximum length of 2000 characters.  When input 
> validation fails for both fields I get the following messages (text in 
> parentheses I added):
> 
> Bin Name is required. (good!)
> null can not be greater than 2000 characters.  (not good)
> 
> I'm actually using the same key to test both though.  Here is my 
> validation.xml file:
> 
> 
>
>  
>  property="title"
>  depends="required">
>  
>
>  property="description"
>  depends="maxlength">
>  
>   resource="false"/>
>  
>maxlength
>2000
>  
>
>  
>
> 
> 
> Any ideas anyone?  Thanks,
> 
> Matt
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]