Oh, try adding the translator: binding as well :)
On 2/17/06, Brian Long <[EMAIL PROTECTED]> wrote:
>
> Jesse,
>
> thanks for the quick reply, but I have bound the value to
> "ognl:amount", which is a BigDecimal (a subclass of Number) used in my
> java class? Is this a step to far for the Compiler/Tapestry framework,
> because if what you say is true, this should have worked.
>
> Brian.
>
> On 2/17/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
> > You need to have you value binding for TextField be either a Numeric
> object
> > type or native numeric value. That's just the way it is for now...Won't
> be
> > in tap4.1...
> >
> >
> > On 2/17/06, Brian Long <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi guys,
> > >
> > > I've spend this afternoon trying to get the minimum and maximum
> validators
> > > for Tapestry 4.0 to work without success.
> > >
> > > I have a TextField component with an associated FieldLabel component
> onto
> > > which I attach the Min and Max validators :
> > >
> > > <td>
> > > <label jwcid="@FieldLabel" field="component:dummyTextField"
> displayName=
> > > "DummyTextField">DummyTextField</label>
> > > </td>
> > > <td>
> > > <input jwcid="[EMAIL PROTECTED]" value="ognl:amount"
> > > validators="validators:min=15,max=5000"
> > > size="10" />
> > > </td>
> > >
> > > Pretty straightforward, or so you'd think! The problem is that I get a
> > > Class
> > > Cast Exception when I run the application
> > >
> > > >>java.lang.ClassCastException
> > > >>java.lang.String
> > >
> > > in Tapestry and I enter data into this textfield and submit the form.
> The
> > > problem is that the validate method in Min Class (
> > > org.apache.tapestry.form.validator.Min.validate(Min.java:53)), as you
> can
> > > see it's trying to cast the contents of the received
> > > Object to an Number, the problem it that this Object Contains a
> String,
> > > well, we are using a TextField component after all?
> > >
> > > public void validate(IFormComponent field, ValidationMessages
> messages,
> > > Object object)
> > > throws ValidatorException
> > > {
> > > Number value = (Number) object;
> > >
> > > if (_min > value.doubleValue())
> > > throw new ValidatorException(buildMessage(messages,
> field),
> > > ValidationConstraint.TOO_SMALL);
> > > }
> > >
> > > Now I know that you can't cast from a String to a
> > > Number,Integer,BigDecimal
> > > etc, but it's an Object we're casting from. I
> > > know that it contains a string, but its a numeric string i.e "123", is
> it
> > > that the Min class is at fault here or is it something I'm
> > > doing wrong?
> > >
> > > If Jesse Kuhnert is reading this and has five minutes to deliver the
> > > answer
> > > to my question it would be much appreciated.
> > >
> > > Brian Long.
> > >
> > >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>