Hi,

Can you give some examples with pseudo data ? It is a bit hard to follow
what is the requirement.
If I follow correctly you have a radio group. Depending on the selected
radio you have to make a call to a web service and render some form
controls dynamically for the web service response, right ?

You can have just one Panel for the dynamic part of the form. Start with an
EmptyPanel and selecting a radio will replace it with another one. To
create the dynamic form controls you will need a set (of Fragment or Panel)
of all possible controls and just add them to a repeater.

Martin Grigorov
Wicket Training and Consulting


On Fri, May 30, 2014 at 11:18 AM, sim999 <[email protected]> wrote:

> Hello,
>
> I'm a new user of Wicket and I would like to have your opinion.
>
> Here is what I'm trying to do :
>
> Step 1 : My application calls a web service to retrieve some data.
>
> Step 2 :
> Based on these data the application must build a big web form, this form
> ask
> the user many questions
> (15-20 for instance, most of the time yes/no questions (without submit
> button), sometimes new inputs may appear etc).
> Each time a response is given a new question appears (conditions of
> appearance can be the previous response and / or data retrieved by the web
> service).
> At the beginning all the questions are invisible.
>
> I have multiple options to architecture this :
>
>  - Initialize all the panels for each question and make them invisible at
> the beginning. Use Ajax on each Radio Button (yes / no), checkbox etc and
> make them appear.
> The problem as see with this solution is that it forces me to add all the
> panels to the form and "the logic of appearance" is fragmented in each
> panel
> which handle the question.
> The other problem is that we need the server (Ajax for each response) even
> though it isn't needed once we retrieved the data from the web service.
> The last problem I see is that how do I manage to hide all the children of
> a
> panel if the user decide to go back and change his response to a previous
> question.
>
> - Same as previous but I add dynamically the panel / question for each
> response. However once again
>  "the logic of appearance" is fragmented in each question and it is
> difficult to maintain.
>
> - Same as previous but all in JavaScript. I will need to convert all the
> data from the web service to JavaScript variables not really the wicket
> Way...
>
> - Maybe I could use Nested Forms but I lack the required distance to be a
> good judge. I don't really know if is really the best response to my
> problem.
>
>  - Finally What about the form Component panel ?
>
> Note : There are in fact many big forms depending on the user profile.
>
> If you could give me your take on this I will be really grateful.
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Dynamic-Form-Best-Architecture-tp4666065.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to