You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kamiseq <ka...@gmail.com> on 2011/07/02 21:00:55 UTC

form component that is rendered as select or read-only input

hej,
Im creating a component that is a panel - part of a form. I pass a
LoadableDetachableModel to it with a list of items.
when list size is greater then 1 I display a select html component to render
all choices. but when list contains only one item I would like to show read
only input because at this time user will not be able to choose another item
anyway.

but when I close a page with form and update list (ie item was added so
there is more than one or items was removed so there is only one item) and
reopen the page with the form again I will see form with wrong component
(right?) as whole page was saved and panel with form components will not be
created again (right?).

how can I design this panel so it is more dynamic? should I use repeaters?
or something like that?
thanks for any help

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: form component that is rendered as select or read-only input

Posted by kamiseq <ka...@gmail.com>.
why not call this code in onBeforeRender?? as I read Component code
onConfigure is called once per request and so is onBeforeRender and javadoc
states that

NOTE: Component hierarchy should not be modified inside this method
(onConfigure), instead it should be done in {@link #onBeforeRender()}

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: form component that is rendered as select or read-only input

Posted by kamiseq <ka...@gmail.com>.
hym ;]

thanks;]

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: form component that is rendered as select or read-only input

Posted by Igor Vaynberg <ig...@gmail.com>.
panel {
 onconfigure() {
    if (items>1) { addorreplace("foo", new dropdownchoice(); }
    else { addorreplace("foo", new textfield().setenabled(false); }
  }}

-igor

On Sat, Jul 2, 2011 at 12:00 PM, kamiseq <ka...@gmail.com> wrote:
> hej,
> Im creating a component that is a panel - part of a form. I pass a
> LoadableDetachableModel to it with a list of items.
> when list size is greater then 1 I display a select html component to render
> all choices. but when list contains only one item I would like to show read
> only input because at this time user will not be able to choose another item
> anyway.
>
> but when I close a page with form and update list (ie item was added so
> there is more than one or items was removed so there is only one item) and
> reopen the page with the form again I will see form with wrong component
> (right?) as whole page was saved and panel with form components will not be
> created again (right?).
>
> how can I design this panel so it is more dynamic? should I use repeaters?
> or something like that?
> thanks for any help
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>

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