Hi,

my intention is to check if special mandatory fields are filled.
What I found in the examples is the RequiredTextField... within the Wicket
lib.

I use a RadioBtnGroup with RadioBtn's, the user has to select one!
Thats all what I validate.

But no matter, with your hint I can solve that problem. Maybe I implement an
own RadioBtnGroup-Komponent who can check this in general, like the
RequiredTextField... :-)

regards
- jk



Matthias Keller wrote:
> 
> Hi
> 
> Just one note - I just had another look at our FormValidator class - you 
> might wonder why you won't find the method  error (FormComponent fc, 
> String resourceKey)  provided in my example. The reason is, we wrapped 
> this to provide a direct access to localized error messages in our 
> custom FormValidator:
> 
>     /**
>      * Reports an error against the validatable using the given literal 
> resource key. This means, no
>      * class prefix is prepended to the resource key.
>      *
>      * @param fc form component against which the error is reported
>      * @param resourceKey The resource key to use
>      */
>     @Override
>     public void error (FormComponent fc, String resourceKey) {
>         fc.error(fc.getLocalizer().getString(resourceKey, fc));
>     }
> 
> 
> Just calling   error (Serializable message)  inside your form validator 
> implementation will of course report the error against the FormValidator 
> and not the failing component.
> So make sure you call    myTextFieldThatFailed.error(...)   instead of   
> error(...)
> 
> The Wizard will later test, if all contained components were successful 
> and only advance if none of them had its  FormComponent.error() method 
> invoked.
> 
> Good luck
> 
> Matt
> 
> jackkilian wrote:
>> Hi Matthias,
>>
>> thanks! I used error(), but the wizard didn't stop. I will check it,
>> maybe I
>> use a ref-Object to call error().
>>
>> regards
>> - jk
>>
>>
>> Matthias Keller wrote:
>>   
>>> [email protected] wrote:
>>>     
>>>> Hi,
>>>>
>>>> when I validate the data of a WizardStep after pressing Next, I
>>>> navigate within the validate method to the WizardStep.previous()
>>>> step in the false case.
>>>>
>>>> Works fine! But calling the method WizardStep.previous() works
>>>> not for the first Wizard step. That's ok, there is no previous
>>>> one.
>>>> But how can I do it right?
>>>>   
>>>>       
>>> Hi
>>>
>>> Not sure why you even want to call next or previous at all manually?
>>> I'm using 1.3.5 so that may make a difference but we're just adding 
>>> validators to the WizardStep which takes care of everything. We never 
>>> have to manually call previous() or next() ?
>>>
>>> We're just doing:
>>>
>>>         add(new FormValidator() {
>>>             public FormComponent[] getDependentFormComponents() {
>>>                 return new FormComponent[] { radioGroup, checkbox };
>>>             }
>>>             public void validate (Form form) {
>>>                 if (isSelected(radioGroup, radio1)) {
>>>                     if (isChecked(checkbox)) {
>>>                         error(checkbox, "our.error");
>>>                     }
>>>                 }
>>>             }
>>>         });
>>>
>>> Note that FormValidator is our implementation of AbstractFormValidator 
>>> which is just there to provide some helper methods like the isSelected() 
>>> and isChecked() plus some optimizations.
>>> Now when the error() is called, the wizard won't go to the next step.
>>>
>>> Matt
>>>
>>> -- 
>>> [email protected]  +41 44 268 83 98
>>> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
>>> http://www.ergon.ch
>>> ______________________________________________________________
>>> e r g o n    smart people - smart software
>>>
>>> Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
>>> Mai 2009 unter www.fairnesspreis.ch 
>>>
>>>
>>>
>>>  
>>>
>>>     
>>
>>   
> 
> 
> -- 
> [email protected]  +41 44 268 83 98
> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
> http://www.ergon.ch
> ______________________________________________________________
> e r g o n    smart people - smart software
> 
> Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
> Mai 2009 unter www.fairnesspreis.ch 
> 
> 
> 
>  
> 

-- 
View this message in context: 
http://www.nabble.com/Validate%2C-Navigate-Wizards-tp23364393p23366599.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to