Here is an example of Ajax form submit:
http://www.wicket-library.com/wicket-examples-6.0.x/ajax/form<http://www.wicket-library.com/wicket-examples-6.0.x/ajax/form?0>


On Mon, Apr 29, 2013 at 1:56 AM, Taro Fukunaga <taro4cy...@gmail.com> wrote:

> If I just try to get the value from the field, I see that the value is
> null.
>
>         textInput = new TextField<Integer>( "textInput", new
> IModel<Integer>() {
>
>             @Override
>             public void detach() {
>                 // TODO Auto-generated method stub
>
>             }
>
>             @Override
>             public Integer getObject() {
>                 return days;
>             }
>
>             @Override
>             public void setObject( Integer object ) {
>                 value = object.intValue(); // 'object' is null, causes NPE
>             }
>         }, Integer.class );
>
>         input.add( new IValidator<Integer>() {
>
>             private static final long serialVersionUID = 1L;
>
>             @Override
>             public void validate( IValidatable<Integer> validatable ) {
>                 if ( !isValidNumber( validatable.getValue() ) ) {
>                     validatable.error( new ValidationError( "The input is
> not valid" ) );
>                 }
>             }
>
>         } );
>
> I think this is what I really don't understand. Why is the value of my text
> field null if the form is submitted with an AjaxButton? I think with a
> regular Button it was okay. Now the code never goes to the validator.
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Form-not-displaying-messages-correctly-tp4658351p4658370.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com <http://jweekend.com/>

Reply via email to