You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by John Cavacas <jo...@sapiens.com> on 2003/06/08 15:47:01 UTC

[validator] arg0-arg3 elements need name attribute to display mes sage?

I've been doing some messing around with the Validator and ran into an issue
I haven't seen mentioned on the list yet. I'm using 2 day old nightly builds
of Struts and commons-validator. Now, this is my first time trying out the
validator so I could be doing something wrong as well.

Anyway from all the examples that I have seen, and postings on the list,
this is how to define a validator for a form/field:

<form name="testForm">
	<field property="name" 
  	       depends="required">
	<arg0 key="testform.name"/>
	</field>
	<field property="value" 
		depends="required">
	<arg0 key="testform.value"/>
	</field>
</form>

Now, validation DOES happen, however the message keys (and I only have one
bundle) "testform.name" and "testform.value" are not used when a validation
occurs. Instead I get: "null is required". The only way I was able to get
the proper message key to work, was to specify the arg* elements like this:

	<arg0 name="required" key="testform.name"/>

In other words, I have to reference the validator name being used in the
arg* in order for the message to resolve. This is something that I haven't
seen mentioned anywhere in the existing documentation, books, or on the
list. Is it a bug or a new requirement? This happens with all Validator form
types, and my own "Dyna" form class.

Thanks,
John



This communication is intended for the use of the individual(s) or entity it
was addressed to and may contain confidential and/or privileged information.
If the reader of this transmission is not the intended recipient, you are
hereby notified that any review, dissemination, distribution or copying of
this communication is prohibited.  If you receive this communication in
error, please notify the sender immediately and delete this communication
from your system(s) to which it was sent and/or replicated to. (c) 2003
Sapiens Americas Corp.