Re: [validator] maxlength not reading from resource bundle

2003-09-09 Thread David Graham
Try:
arg0 name=maxlength key=${var:maxlength} resource=false/

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:
 
 form-validation
formset
  form name=bin
field
  property=title
  depends=required
  arg0 key=label.bin.title/
/field
field
  property=description
  depends=maxlength
  arg0 name=fieldname key=label.bin.title/
  arg1 name=maxlength key=${var:maxlength}
 resource=false/
  var
var-namemaxlength/var-name
var-value2000/var-value
  /var
/field
  /form
/formset
 /form-validation
 
 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]



Re: [validator] maxlength not reading from resource bundle

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

arg0 key=label.bin.title/

but this will work:

arg0 key=label.bin.title resource=true/

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)
  field
property=description
depends=maxlength
arg0 name=fieldname key=label.bin.title/
arg1 name=maxlength key=${var:maxlength} resource=false/
var
  var-namemaxlength/var-name
  var-value2000/var-value
/var
  /field


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.]

 field
property=socialSecurityNumberA
depends=required,length,positiveNumber,mask
msg name=length key=errors.lengthDigits/
arg0 key=label.socialSecurityNumberA resource=true/
arg1 key=${var:length} name=length resource=false/
var
var-namelength/var-name
var-value3/var-value
/var
var
var-namemask/var-name
var-value^[0-9][0-9][0-9]$/var-value
/var
 /field
David Graham [EMAIL PROTECTED] wrote:

Try:
arg0 name=maxlength key=${var:maxlength} resource=false/
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
--- Sgarlata Matt [EMAIL PROTECTED] wrote:
 Ah-hah, figured it out.  This will not work:
 
 arg0 key=label.bin.title/
 
 but this will work:
 
 arg0 key=label.bin.title resource=true/
 
 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:
arg0 name=fieldname key=label.bin.title/

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?
arg0 name=maxlength key=label.bin.title/

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)
 
field
  property=description
  depends=maxlength
  arg0 name=fieldname key=label.bin.title/
  arg1 name=maxlength key=${var:maxlength}
 resource=false/
  var
var-namemaxlength/var-name
var-value2000/var-value
  /var
/field
  
  
  
  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.]
  
   field
  property=socialSecurityNumberA
  depends=required,length,positiveNumber,mask
  msg name=length key=errors.lengthDigits/
  arg0 key=label.socialSecurityNumberA resource=true/
  arg1 key=${var:length} name=length resource=false/
  var
  var-namelength/var-name
  var-value3/var-value
  /var
  var
  var-namemask/var-name
  var-value^[0-9][0-9][0-9]$/var-value
  /var
   /field
  
  David Graham [EMAIL PROTECTED] wrote:
  
 Try:
 arg0 name=maxlength key=${var:maxlength} resource=false/
 
 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
David Graham wrote:
I'm confused by your setup:
arg0 name=fieldname key=label.bin.title/
Yeah, I was trying random stuff.  The final thing that worked was:

field
  property=description
  depends=maxlength
  arg0 key=label.bin.title resource=true/
  arg1 name=maxlength key=${var:maxlength} resource=false/
  var
var-namemaxlength/var-name
var-value2000/var-value
  /var
/field
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?
arg0 name=maxlength key=label.bin.title/
Interesting, that works too.  So the complete field element is:

field
  property=description
  depends=maxlength
  arg0 name=maxlength key=label.bin.title/
  arg1 name=maxlength key=${var:maxlength} resource=false/
  var
var-namemaxlength/var-name
var-value2000/var-value
  /var
/field
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:
 David Graham wrote:
  I'm confused by your setup:
  arg0 name=fieldname key=label.bin.title/
 
 Yeah, I was trying random stuff.  The final thing that worked was:
 
 field
property=description
depends=maxlength
arg0 key=label.bin.title resource=true/
arg1 name=maxlength key=${var:maxlength} resource=false/
var
  var-namemaxlength/var-name
  var-value2000/var-value
/var
 /field
 
 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?
  arg0 name=maxlength key=label.bin.title/
 
 Interesting, that works too.  So the complete field element is:
 
 field
property=description
depends=maxlength
arg0 name=maxlength key=label.bin.title/
arg1 name=maxlength key=${var:maxlength} resource=false/
var
  var-namemaxlength/var-name
  var-value2000/var-value
/var
 /field

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:
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 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)
 
field
  property=description
  depends=maxlength
  arg0 name=fieldname key=label.bin.title/
  arg1 name=maxlength key=${var:maxlength} resource=false/
  var
var-namemaxlength/var-name
var-value2000/var-value
  /var
/field


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.]

 field
property=socialSecurityNumberA
depends=required,length,positiveNumber,mask
msg name=length key=errors.lengthDigits/
arg0 key=label.socialSecurityNumberA resource=true/
arg1 key=${var:length} name=length resource=false/
var
var-namelength/var-name
var-value3/var-value
/var
var
var-namemask/var-name
var-value^[0-9][0-9][0-9]$/var-value
/var
 /field

David Graham [EMAIL PROTECTED] wrote:
 Try:
 arg0 name=maxlength key=${var:maxlength} resource=false/
 
 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]