I tried that and get the following:

Component must be applied to a tag with [type] attribute matching [number],
not [text]

So it really wants it to be a number... just not sure why it won't accept
decimals.

Thanks...

Bill-


On Sun, Mar 10, 2013 at 4:11 PM, Paul Bors <[email protected]> wrote:

> Your HTML input type is "number", try using "text" as Wicket would use its
> internal converter to convert (cast) the string user input in HTML to the
> backing model object type (double in your case).
>
> HTML input tag:
> http://www.w3schools.com/tags/att_input_type.asp
>
> Wicket custom converters:
> https://cwiki.apache.org/WICKET/using-custom-converters.html
> Wicket's double converter:
>
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/util/convert/converter/DoubleConverter.html
>
> As a side note, I've noticed you're using the label's for attribute which
> wicket supports in different formats.
>
> Take a look at the Wicket's XHTML tags:
>
> https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-Attributewicket%253Afor
> And also in Java as FormComponentLabel:
>
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/markup/html/form/FormComponentLabel.html
>
> ~ Thank you,
>    Paul C Bors
>
> On Mar 10, 2013, at 15:38, William Speirs <[email protected]> wrote:
>
> > I'm trying to use a NumberTextField with a type of Double and the form
> will
> > only let me type in integers (or doubles that end in .0). Is this a known
> > issue? Is there a workaround?
> >
> > My basic code...
> >
> > *Java*
> >    private IModel<Double> doubleModel;
> >
> >        final NumberTextField<Double> d = new NumberTextField<Double>("d",
> > doubleModel, Double.class);
> >
> >        d.setMinimum(1.0d);
> >        d.setMaximum(1000.0d);
> >        d.setRequired(true);
> >
> >        form.add(d);
> >
> > *HTML*
> >
> >                  <div class="control-group">
> >                    <label class="control-label" for="d">Double</label>
> >                    <div class="controls">
> >                      <input type="number" wicket:id="d"></input>
> >                    </div>
> >                  </div>
> >
> >
> > Am I using the wrong component or HTML input type or something? Every
> time
> > I type in a number like 5.5 and try to submit the form I get the pop-up
> > that say, "Invalid value."
> >
> > Thoughts?
> >
> > Thanks...
> >
> > Bill-
>

Reply via email to