You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jeroen Dijkmeijer <je...@dijkmeijer.com> on 2010/02/02 21:58:06 UTC

dropdown doesnot set selected value after setVisible()

Hi,

I'm struggling my way into wicket, I've a sort of wizard like page,  
after the user submits the form, new input fields become visible. I  
also want a textinput field to become visible together with a  
dropdownbox.
In the constructor I fill the choices and set the initial (selected)  
value. After the user submits, I set the textinputfield to be visible,  
which will cause all the components in the surrounded enclosure to  
become visible.
So far so good however the selected value is not recognised and the  
"choose one" thing is shown. Code snippets are below
Any help is appreciated.
Jeroen
constructor:
..
                 String pollType = "Wanneer";
                 lijst = new ArrayList<String>();
                 lijst.add("Wanneer");
                 lijst.add("Wie");
                 lijst.add("Waar");
                 lijst.add("Wat");
                 lijst.add("Welk bedrag");
                 lijst.add("Weet nog niet");
                 form.add(new ListChoice<String>("poll_type", new  
Model(pollType), lijst));
                 add(form);


inner class:
         class SaveButton extends Button {
                 /**
                  *
                  */
                 private static final long serialVersionUID =  
109611211318049267L;

                 private SaveButton() {
                         super("save", new ResourceModel("save"));
                 }

                 @Override
                 public void onSubmit() {
                         try {
                                  
getParent().get("poll_part_header").setVisible(true);

My html code:
<wicket:enclosure child="poll_part_header">
         <div class="input-line"><wicket:message  
key="lbl.poll.part.header">[header]</wicket:message>
                 <select wicket:id="poll_type" size="1"/>
                 <input wicket:id="poll_part_header" type="text"  
size="50"/>
         </div>
</wicket:enclosure> 

Re: enclosures only allow one input component?

Posted by Igor Vaynberg <ig...@gmail.com>.
enclosures dont really play nice with formcomponents, use
EnclsoureContainer instead.

On Wed, Feb 3, 2010 at 3:03 AM, Jeroen Dijkmeijer <je...@dijkmeijer.com> wrote:
> it looks like only one input component (the one indicated by the child
> attribute) get its value bound to the model inside an enclosure tag, the
> documentation (WIA and
> http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html) could give some more
> information on this constraint.
> Is there a way to get around this by overloading methods or so, or should I
> proceed with grouping them on panels, fragments or something else?
>
> regards,
> Jeroen.
> On Feb 2, 2010, at 9:58 PM, Jeroen Dijkmeijer wrote:
>
>> Hi,
>>
>> I'm struggling my way into wicket, I've a sort of wizard like page, after
>> the user submits the form, new input fields become visible. I also want a
>> textinput field to become visible together with a dropdownbox.
>> In the constructor I fill the choices and set the initial (selected)
>> value. After the user submits, I set the textinputfield to be visible, which
>> will cause all the components in the surrounded enclosure to become visible.
>> So far so good however the selected value is not recognised and the
>> "choose one" thing is shown. Code snippets are below
>> Any help is appreciated.
>> Jeroen
>> constructor:
>> ..
>>               String pollType = "Wanneer";
>>               lijst = new ArrayList<String>();
>>               lijst.add("Wanneer");
>>               lijst.add("Wie");
>>               lijst.add("Waar");
>>               lijst.add("Wat");
>>               lijst.add("Welk bedrag");
>>               lijst.add("Weet nog niet");
>>               form.add(new ListChoice<String>("poll_type", new
>> Model(pollType), lijst));
>>               add(form);
>>
>>
>> inner class:
>>       class SaveButton extends Button {
>>               /**
>>                *
>>                */
>>               private static final long serialVersionUID =
>> 109611211318049267L;
>>
>>               private SaveButton() {
>>                       super("save", new ResourceModel("save"));
>>               }
>>
>>               @Override
>>               public void onSubmit() {
>>                       try {
>>
>> getParent().get("poll_part_header").setVisible(true);
>>
>> My html code:
>> <wicket:enclosure child="poll_part_header">
>>       <div class="input-line"><wicket:message
>> key="lbl.poll.part.header">[header]</wicket:message>
>>               <select wicket:id="poll_type" size="1"/>
>>               <input wicket:id="poll_part_header" type="text" size="50"/>
>>       </div>
>> </wicket:enclosure>
>
>
> ---------------------------------------------------------------------
> 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


enclosures only allow one input component?

Posted by Jeroen Dijkmeijer <je...@dijkmeijer.com>.
it looks like only one input component (the one indicated by the child  
attribute) get its value bound to the model inside an enclosure tag,  
the documentation (WIA and http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html) 
  could give some more information on this constraint.
Is there a way to get around this by overloading methods or so, or  
should I proceed with grouping them on panels, fragments or something  
else?

regards,
Jeroen.
On Feb 2, 2010, at 9:58 PM, Jeroen Dijkmeijer wrote:

> Hi,
>
> I'm struggling my way into wicket, I've a sort of wizard like page,  
> after the user submits the form, new input fields become visible. I  
> also want a textinput field to become visible together with a  
> dropdownbox.
> In the constructor I fill the choices and set the initial (selected)  
> value. After the user submits, I set the textinputfield to be  
> visible, which will cause all the components in the surrounded  
> enclosure to become visible.
> So far so good however the selected value is not recognised and the  
> "choose one" thing is shown. Code snippets are below
> Any help is appreciated.
> Jeroen
> constructor:
> ..
>                String pollType = "Wanneer";
>                lijst = new ArrayList<String>();
>                lijst.add("Wanneer");
>                lijst.add("Wie");
>                lijst.add("Waar");
>                lijst.add("Wat");
>                lijst.add("Welk bedrag");
>                lijst.add("Weet nog niet");
>                form.add(new ListChoice<String>("poll_type", new  
> Model(pollType), lijst));
>                add(form);
>
>
> inner class:
>        class SaveButton extends Button {
>                /**
>                 *
>                 */
>                private static final long serialVersionUID =  
> 109611211318049267L;
>
>                private SaveButton() {
>                        super("save", new ResourceModel("save"));
>                }
>
>                @Override
>                public void onSubmit() {
>                        try {
>                                 
> getParent().get("poll_part_header").setVisible(true);
>
> My html code:
> <wicket:enclosure child="poll_part_header">
>        <div class="input-line"><wicket:message  
> key="lbl.poll.part.header">[header]</wicket:message>
>                <select wicket:id="poll_type" size="1"/>
>                <input wicket:id="poll_part_header" type="text"  
> size="50"/>
>        </div>
> </wicket:enclosure>


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