You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Per Newgro <pe...@gmx.ch> on 2014/01/10 09:01:47 UTC

NumberTextField eats my markup step attribute

Hi,

i would like to enable float values in my form (without validation error).
But it's not possible for me.

If i add this input markup

<input type="number" step="any" wicket:id="myNumber" />

and assign a

new NumberTextField<Double>("myNumber", numberModel);

the resulting markup is

<input type="number" id="myNumber1" />

So i'm not able to get a valid form submit with a value of 12.5 because step="any" has been removed
(NumberTextField@190).

The NumberTextField.setStep is also unusable because it uses a Number parameter
which is "any" obviously not :-).

is there another workaround or is a ticket required?

Thanks for your support
Per

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


Aw: NumberTextField eats my markup step attribute

Posted by Per Newgro <pe...@gmx.ch>.
Because the w3c-spec says

"step = "any" or positive floating-point number NEW
Specifies the value granularity of the element’s value."

and

"Positive floating-point number #
A non-negative floating-point number, with the following restriction:
must be greater than zero"

http://dev.w3.org/html5/markup/input.number.html

it should be valid to use 0 or <0 as special constant in NumberTextField.

NumberTextField

public static final Number ANY = 0;

and


	@Override
	protected void onComponentTag(final ComponentTag tag)
	{
...

		if (step != null)
		{
			if (step.equals(ANY)
			{
				attributes.put("step", "any");
			}
			else
			{
				attributes.put("step", Objects.stringValue(step));
			}
		}
		else
		{
			attributes.remove("step");
		}
...
	}

This should do the trick without any change in current behavior.

Thanks
Per

Then i could do
> Gesendet: Freitag, 10. Januar 2014 um 09:01 Uhr
> Von: "Per Newgro" <pe...@gmx.ch>
> An: "wicket usergroup" <us...@wicket.apache.org>
> Betreff: NumberTextField eats my markup step attribute
>
> Hi,
> 
> i would like to enable float values in my form (without validation error).
> But it's not possible for me.
> 
> If i add this input markup
> 
> <input type="number" step="any" wicket:id="myNumber" />
> 
> and assign a
> 
> new NumberTextField<Double>("myNumber", numberModel);
> 
> the resulting markup is
> 
> <input type="number" id="myNumber1" />
> 
> So i'm not able to get a valid form submit with a value of 12.5 because step="any" has been removed
> (NumberTextField@190).
> 
> The NumberTextField.setStep is also unusable because it uses a Number parameter
> which is "any" obviously not :-).
> 
> is there another workaround or is a ticket required?
> 
> Thanks for your support
> Per
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
>

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


Re: Re: NumberTextField eats my markup step attribute

Posted by Martin Grigorov <mg...@apache.org>.
Do you want to add suggested improvement as a patch (+test) ? :)

Martin Grigorov
Wicket Training and Consulting


On Fri, Jan 10, 2014 at 11:13 AM, Per Newgro <pe...@gmx.ch> wrote:

> Thank you Martin.
> Done
> https://issues.apache.org/jira/browse/WICKET-5467
>
> > Gesendet: Freitag, 10. Januar 2014 um 09:09 Uhr
> > Von: "Martin Grigorov" <mg...@apache.org>
> > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > Betreff: Re: NumberTextField eats my markup step attribute
> >
> > Hi,
> >
> > This is a bug.
> > Please file a ticket.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Fri, Jan 10, 2014 at 10:01 AM, Per Newgro <pe...@gmx.ch> wrote:
> >
> > > Hi,
> > >
> > > i would like to enable float values in my form (without validation
> error).
> > > But it's not possible for me.
> > >
> > > If i add this input markup
> > >
> > > <input type="number" step="any" wicket:id="myNumber" />
> > >
> > > and assign a
> > >
> > > new NumberTextField<Double>("myNumber", numberModel);
> > >
> > > the resulting markup is
> > >
> > > <input type="number" id="myNumber1" />
> > >
> > > So i'm not able to get a valid form submit with a value of 12.5 because
> > > step="any" has been removed
> > > (NumberTextField@190).
> > >
> > > The NumberTextField.setStep is also unusable because it uses a Number
> > > parameter
> > > which is "any" obviously not :-).
> > >
> > > is there another workaround or is a ticket required?
> > >
> > > Thanks for your support
> > > Per
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Aw: Re: NumberTextField eats my markup step attribute

Posted by Per Newgro <pe...@gmx.ch>.
Thank you Martin.
Done
https://issues.apache.org/jira/browse/WICKET-5467

> Gesendet: Freitag, 10. Januar 2014 um 09:09 Uhr
> Von: "Martin Grigorov" <mg...@apache.org>
> An: "users@wicket.apache.org" <us...@wicket.apache.org>
> Betreff: Re: NumberTextField eats my markup step attribute
>
> Hi,
> 
> This is a bug.
> Please file a ticket.
> 
> Martin Grigorov
> Wicket Training and Consulting
> 
> 
> On Fri, Jan 10, 2014 at 10:01 AM, Per Newgro <pe...@gmx.ch> wrote:
> 
> > Hi,
> >
> > i would like to enable float values in my form (without validation error).
> > But it's not possible for me.
> >
> > If i add this input markup
> >
> > <input type="number" step="any" wicket:id="myNumber" />
> >
> > and assign a
> >
> > new NumberTextField<Double>("myNumber", numberModel);
> >
> > the resulting markup is
> >
> > <input type="number" id="myNumber1" />
> >
> > So i'm not able to get a valid form submit with a value of 12.5 because
> > step="any" has been removed
> > (NumberTextField@190).
> >
> > The NumberTextField.setStep is also unusable because it uses a Number
> > parameter
> > which is "any" obviously not :-).
> >
> > is there another workaround or is a ticket required?
> >
> > Thanks for your support
> > Per
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 

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


Re: NumberTextField eats my markup step attribute

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

This is a bug.
Please file a ticket.

Martin Grigorov
Wicket Training and Consulting


On Fri, Jan 10, 2014 at 10:01 AM, Per Newgro <pe...@gmx.ch> wrote:

> Hi,
>
> i would like to enable float values in my form (without validation error).
> But it's not possible for me.
>
> If i add this input markup
>
> <input type="number" step="any" wicket:id="myNumber" />
>
> and assign a
>
> new NumberTextField<Double>("myNumber", numberModel);
>
> the resulting markup is
>
> <input type="number" id="myNumber1" />
>
> So i'm not able to get a valid form submit with a value of 12.5 because
> step="any" has been removed
> (NumberTextField@190).
>
> The NumberTextField.setStep is also unusable because it uses a Number
> parameter
> which is "any" obviously not :-).
>
> is there another workaround or is a ticket required?
>
> Thanks for your support
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>