Re: Validate, Navigate Wizards

2009-05-04 Thread jackkilian

Hi,

sometimes the world is easy! Thanks for your support. Thinking in Wicket
means, to think easier :-D

For other readers, to get the right "required" validation message at the
feebackPanel an entry has to written into the Wizard's property file.

e.g. group.Required=My message on the feebackpanel...

So, the thread could be closed :clap:





Matthias Keller wrote:
> 
> Hi
> 
> If you only want to require that a radio button is selected, then  
> myRadioGroup.setRequired(true)  already does that job. No need to 
> implement a custom form validator then.
> BTW: RequiredTextField is nothing other than a TextField which calls  
> setRequired(true)  in the constructor.. It's only here for convenience 
> since it is used very often.
> so,  .setRequired(true)  is your friend as long as you only want to 
> check if a radio button has been selected.
> 
> Matt
> 
> jackkilian wrote:
>> 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 callmyTextFieldThatFailed.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:
   
   
> wolfgang.sch...@dachser.com 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
>
> -- 
> matthias.kel...@ergon.ch  +41 44 268 83 98
> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
> http://www.ergon.ch
> __
> e r g o nsmart people - smart software
>
> Ergon ist im Final für den Fairnesspreis 2009 - Online-Abst

Re: Validate, Navigate Wizards

2009-05-04 Thread Matthias Keller

Hi

If you only want to require that a radio button is selected, then  
myRadioGroup.setRequired(true)  already does that job. No need to 
implement a custom form validator then.
BTW: RequiredTextField is nothing other than a TextField which calls  
setRequired(true)  in the constructor.. It's only here for convenience 
since it is used very often.
so,  .setRequired(true)  is your friend as long as you only want to 
check if a radio button has been selected.


Matt

jackkilian wrote:

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 callmyTextFieldThatFailed.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:
  
  

wolfgang.sch...@dachser.com 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

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
Mai 2009 unter www.fairnesspreis.ch 




 



  
  

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
Mai 2009 unter www.fairnesspreis.ch 




 




  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Validate, Navigate Wizards

2009-05-04 Thread jackkilian

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 callmyTextFieldThatFailed.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:
>>   
>>> wolfgang.sch...@dachser.com 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
>>>
>>> -- 
>>> matthias.kel...@ergon.ch  +41 44 268 83 98
>>> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
>>> http://www.ergon.ch
>>> __
>>> e r g o nsmart people - smart software
>>>
>>> Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
>>> Mai 2009 unter www.fairnesspreis.ch 
>>>
>>>
>>>
>>>  
>>>
>>> 
>>
>>   
> 
> 
> -- 
> matthias.kel...@ergon.ch  +41 44 268 83 98
> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
> http://www.ergon.ch
> __
> e r g o nsmart 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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Validate, Navigate Wizards

2009-05-04 Thread Matthias Keller

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 callmyTextFieldThatFailed.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:
  

wolfgang.sch...@dachser.com 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

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6.
Mai 2009 unter www.fairnesspreis.ch 




 




  



--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


Re: Validate, Navigate Wizards

2009-05-04 Thread jackkilian

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:
> 
> wolfgang.sch...@dachser.com 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
> 
> -- 
> matthias.kel...@ergon.ch  +41 44 268 83 98
> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
> http://www.ergon.ch
> __
> e r g o nsmart 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-tp23364393p23364909.html
Sent from the Wicket - User 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



Re: Validate, Navigate Wizards

2009-05-04 Thread Matthias Keller

wolfgang.sch...@dachser.com 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

--
matthias.kel...@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
__
e r g o nsmart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch 





smime.p7s
Description: S/MIME Cryptographic Signature


Validate, Navigate Wizards

2009-05-04 Thread Wolfgang . Schele

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?

Is there in general a way to navigate programmatically the
wizards? Depending to the user input the order of the wizards is
different.

Is it possible to override any method before a Wizard Step is
called on the client. What I found was a onNext() Method. But
this method is not existing anymore in the v1.4.

best regards
- jk



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



Validate, Navigate Wizards

2009-05-04 Thread Wolfgang . Schele

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?

Is there in general a way to navigate programmatically the
wizards? Depending to the user input the order of the wizards is
different.

Is it possible to override any method before a Wizard Step is
called on the client. What I found was a onNext() Method. But
this method is not existing anymore in the v1.4.

best regards
- jk



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