You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Arjun Dhar <dh...@yahoo.com> on 2011/03/05 08:10:21 UTC

DropDown replacing text field

Hi,
 i have a markup (Loop) for a couple of fields. Its a dynamic form and all
the fields are text except one or two,
Sample Markup:

		

			

					
					
			
		



Now in the Java code, for the exceptional case I want to replace that
'input' with 'select', so I did:

field = new DropDownChoice("value", new Model(myBooleanvar),
						Arrays.asList(Boolean.FALSE, Boolean.TRUE)) {
						//Default is text type, change to select
						@Override  
						public void onComponentTag(ComponentTag tag) {
								tag.setName("select");
								tag.remove("type");
								super.onComponentTag( tag );
						  }
					};	


..this results in a Blank Drop Down Box withotu any values.

In the markup if I make it "select" it obviously works.
What else do I need to to do to get the "option"s, in the list in such a
case?



-----
Don't take life too seriously, your'e not getting out it alive anyway!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336347.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


Re: DropDown replacing text field

Posted by Arjun Dhar <dh...@yahoo.com>.
(And whats wrong with Nabble ..its got this annoying Ajax interface) :(
Ugh!!!

-----
Don't take life too seriously, your'e not getting out it alive anyway!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336427.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


Re: DropDown replacing text field

Posted by Arjun Dhar <dh...@yahoo.com>.
Thanks...but curiosity : why wont that work in the first place?

-----
Don't take life too seriously, your'e not getting out it alive anyway!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336426.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


Re: DropDown replacing text field

Posted by Martin Grigorov <mg...@apache.org>.
Use two <wicket:fragment>s - one with <input> inside, and one with <select>
Swap the fragments

On Sat, Mar 5, 2011 at 9:10 AM, Arjun Dhar <dh...@yahoo.com> wrote:

> Hi,
>  i have a markup (Loop) for a couple of fields. Its a dynamic form and all
> the fields are text except one or two,
> Sample Markup:
>
>
>
>
>
>
>
>
>
>
>
>
> Now in the Java code, for the exceptional case I want to replace that
> 'input' with 'select', so I did:
>
> field = new DropDownChoice("value", new Model(myBooleanvar),
>                                                Arrays.asList(Boolean.FALSE,
> Boolean.TRUE)) {
>                                                //Default is text type,
> change to select
>                                                @Override
>                                                public void
> onComponentTag(ComponentTag tag) {
>
>  tag.setName("select");
>
>  tag.remove("type");
>
>  super.onComponentTag( tag );
>                                                  }
>                                        };
>
>
> ..this results in a Blank Drop Down Box withotu any values.
>
> In the markup if I make it "select" it obviously works.
> What else do I need to to do to get the "option"s, in the list in such a
> case?
>
>
>
> -----
> Don't take life too seriously, your'e not getting out it alive anyway!
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336347.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
>
>