You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Hank Heidt <hh...@dsbox.com> on 2005/01/20 23:53:30 UTC

[Widget] Problem validating the length of a string field

Hi,

I am a Cocoon Forms newbie and I am having problems validating the
length of a widget in a repeater.  

When the entered length of the field is zero (i.e., nothing is entered
or I enter some characters and then press backspace) it passes
validation even though I have specified the length to be a minimum of at
least one character. Any ideas how to fix this?

Here is the widget definition that I am using:

<fd:field id="description">
	<fd:label>Description</fd:label>
	<fd:datatype base="string"/>
	<fd:validation>
		<fd:length min="1" max="256">
			<fd:failmessage>The description must be between
1 and 256 characters long.</fd:failmessage>
		</fd:length>
	</fd:validation>
	<fd:hint>Enter a description for the report.</fd:hint>
</fd:field>


Thanks for any help!

-Hank

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [Widget] Problem validating the length of a string field

Posted by Carlos Chávez <cc...@agssa.net>.
Hank Heidt Escribio :-)
>
> Hi,
>
> I am a Cocoon Forms newbie and I am having problems validating the
> length of a widget in a repeater.
>
> When the entered length of the field is zero (i.e., nothing is entered
> or I enter some characters and then press backspace) it passes
> validation even though I have specified the length to be a minimum of at
> least one character. Any ideas how to fix this?
>
> Here is the widget definition that I am using:
>
> <fd:field id="description">
> 	<fd:label>Description</fd:label>
> 	<fd:datatype base="string"/>
> 	<fd:validation>
> 		<fd:length min="1" max="256">
> 			<fd:failmessage>The description must be between
> 1 and 256 characters long.</fd:failmessage>
> 		</fd:length>
> 	</fd:validation>
> 	<fd:hint>Enter a description for the report.</fd:hint>
> </fd:field>

  Hi Hank.

  The problem is what the field is not required, so if the field is
  empty the validation is not fire.

  Cheers.

>
>
> Thanks for any help!
>
> -Hank
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


-- 
Carlos Chávez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org