You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by triswork <tr...@gmail.com> on 2009/04/03 13:25:14 UTC

Re: Form validation without a form component

Thanks for the suggestion Martijn. 
I tried return new FormComponent[0]; and got exactly the same error.

I think my use-case is quite fringe, so I have resigned myself to using the
hidden field that you previously suggested.

 - Tristan


Martijn Dashorst wrote:
> 
> You might try to return an empty array..
> 
> Martijn
> 

-- 
View this message in context: http://www.nabble.com/Form-validation-without-a-form-component-tp22682572p22866535.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Form validation without a form component

Posted by scotthendo <sc...@gmail.com>.
Hi Antoine,

I am doing something similar and was wondering if you could help. I am
trying to validate a large form by overriding the onValidate method but when
I do, all the form values are null.

Some code snippets:

public final class DatasetForm extends Form
    {
        private final DatasetTO dataset = new DatasetTO();
        
        public DatasetForm(final String componentName)
        {
            super(componentName);
            
            add(new TextField("orgName", new PropertyModel(dataset,
"orgName")));

       }

        public final void onSubmit()
        {
              System.out.println(dataset.getOrgName()); // this works fine
and displays the value
        }


         public final void onValidate()
        {
           System.out.println(dataset.getOrgName()); // here it is set to
null
         } 
}

So how can i access the form values from onValidate()

Thanks in advance, scott.


Antoine van Wel wrote:
> 
> for the archive-searchers :)
> 
> simply override onValidate in the Form class, check your listsize
> there & call error() when applicable
> 
> 
> Antoine
> 
> On Fri, Apr 3, 2009 at 12:25 PM, triswork <tr...@gmail.com> wrote:
>>
>> Thanks for the suggestion Martijn.
>> I tried return new FormComponent[0]; and got exactly the same error.
>>
>> I think my use-case is quite fringe, so I have resigned myself to using
>> the
>> hidden field that you previously suggested.
>>
>>  - Tristan
>>
>>
>> Martijn Dashorst wrote:
>>>
>>> You might try to return an empty array..
>>>
>>> Martijn
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Form-validation-without-a-form-component-tp22682572p22866535.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Form-validation-without-a-form-component-tp22682572p27845370.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Form validation without a form component

Posted by Antoine van Wel <an...@gmail.com>.
for the archive-searchers :)

simply override onValidate in the Form class, check your listsize
there & call error() when applicable


Antoine

On Fri, Apr 3, 2009 at 12:25 PM, triswork <tr...@gmail.com> wrote:
>
> Thanks for the suggestion Martijn.
> I tried return new FormComponent[0]; and got exactly the same error.
>
> I think my use-case is quite fringe, so I have resigned myself to using the
> hidden field that you previously suggested.
>
>  - Tristan
>
>
> Martijn Dashorst wrote:
>>
>> You might try to return an empty array..
>>
>> Martijn
>>
>
> --
> View this message in context: http://www.nabble.com/Form-validation-without-a-form-component-tp22682572p22866535.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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