You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Riccardo Trombini <ri...@csnc.ch> on 2010/01/19 14:48:40 UTC

CheckBoxMultipleChoice used in a Wizard Panel

Hi !

I am having problems with a CheckBoxMultipleChoice which I use in a
DynamicWizardStep. I am not able to access the list with the checked
boxes. I try to access on the list by adding an AbstractFormValidator
and overwriting the method validate.


public final class DetailWriteArticleStep extends
CustomDynamicWizardStep {

    	private IDynamicWizardStep nextStep;
	private RequiredTextField<String> titel;

    	public DetailWriteArticleStep(...) {
        	...
        
        	final Input input = new Input(article.getCategory());
        	CheckBoxMultipleChoice categoriySelect = new
CheckBoxMultipleChoice("choices", 
				access.getCategories(),
				new ChoiceRenderer("categoryName",
"categoryId"));
       	categoriySelect.setDefaultModelObject(input);
        	add(categoriySelect);
        	System.out.println( input.choices.size());
	        
		add(new AbstractFormValidator() {
            	public void validate(Form<?> form) {
 
System.out.println(article.getCategory().size());
			}
		}
}


public class Input implements IClusterable{

    /** the selected choices. */
    public List choices = new ArrayList();

    /** adds pre-selected items to the choices list */
    public Input(Article article){
    	for(int i = 0 ; i < article.getCategory().size() ; i++){
    		this.choices.add(article.getCategory().get(i));
    	}
    }
    
    /** adds pre-selected items to the choices list */
    public Input(ArrayList list){
    	for(int i = 0 ; i < list.size() ; i++){
    		this.choices.add(list.get(i));
    	}
    }
}



I also tried to add the Object article with the property "Category" as
the propertyModel of the CheckBoxMultipleChoice but this worked
neighter. The size of the List was always 0.

Can anyone help me ?

Thx !

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


Re: CheckBoxMultipleChoice used in a Wizard Panel

Posted by Igor Vaynberg <ig...@gmail.com>.
if there were no validation errors the selected list should be
available in the model.

-igor

On Tue, Jan 19, 2010 at 5:48 AM, Riccardo Trombini
<ri...@csnc.ch> wrote:
> Hi !
>
> I am having problems with a CheckBoxMultipleChoice which I use in a
> DynamicWizardStep. I am not able to access the list with the checked
> boxes. I try to access on the list by adding an AbstractFormValidator
> and overwriting the method validate.
>
>
> public final class DetailWriteArticleStep extends
> CustomDynamicWizardStep {
>
>        private IDynamicWizardStep nextStep;
>        private RequiredTextField<String> titel;
>
>        public DetailWriteArticleStep(...) {
>                ...
>
>                final Input input = new Input(article.getCategory());
>                CheckBoxMultipleChoice categoriySelect = new
> CheckBoxMultipleChoice("choices",
>                                access.getCategories(),
>                                new ChoiceRenderer("categoryName",
> "categoryId"));
>        categoriySelect.setDefaultModelObject(input);
>                add(categoriySelect);
>                System.out.println( input.choices.size());
>
>                add(new AbstractFormValidator() {
>                public void validate(Form<?> form) {
>
> System.out.println(article.getCategory().size());
>                        }
>                }
> }
>
>
> public class Input implements IClusterable{
>
>    /** the selected choices. */
>    public List choices = new ArrayList();
>
>    /** adds pre-selected items to the choices list */
>    public Input(Article article){
>        for(int i = 0 ; i < article.getCategory().size() ; i++){
>                this.choices.add(article.getCategory().get(i));
>        }
>    }
>
>    /** adds pre-selected items to the choices list */
>    public Input(ArrayList list){
>        for(int i = 0 ; i < list.size() ; i++){
>                this.choices.add(list.get(i));
>        }
>    }
> }
>
>
>
> I also tried to add the Object article with the property "Category" as
> the propertyModel of the CheckBoxMultipleChoice but this worked
> neighter. The size of the List was always 0.
>
> Can anyone help me ?
>
> Thx !
>
> ---------------------------------------------------------------------
> 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: CheckBoxMultipleChoice used in a Wizard Panel

Posted by nunofaria11 <nu...@gmail.com>.
Hi there, 
I am having the same problem you had regarding a CheckBoxMultipleChoice used
in a Wizard Panel: the list within the model containing the chosen items is
always empty. Were you able to solve that problem? And if so, how?

Thanks
Nuno

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-a-form-field-at-run-time-is-it-possible-tp1877626p4642679.html
Sent from the Users forum 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