Hi everybody, this is my first post in the list.

I would like to ask for advice on the following topic: I am developing a
view with wicket, which contains a somewhat intensive logic behind. For
instance, when I select an option in a drop down choice, some fields are
disabled, while other fields are hidden, and when I select some radio
button, other set of fields get disabled or hidden, or are otherwise shown.

With disabled/enabled fields everything went alright, but when I started to
hide fields I discovered the following problem: if the initial situation
indicates that the field must be hidden, then the logic in the behaviors
tried to show them but it was not possible to do so, since the initial
markup never referenced those hidden fields (I discovered that with Ajax
Debug under Mozilla FireFox). It is important to say that, in the
AjaxRequestTarget, I was only adding the fields I changed. So a co-worker
told me I should add to the AjaxRequestTarget the panel or form where the
hidden/shown components lie (in my case it is the form) so they could be
correctly rendered. I tried it and, as he said, the logic started to work:
fields get hidden/shown properly everytime I choose the correct drop down
choices/radios.

But this brought me another problem: if I enter some text on the fields and
then activate one of these logics, all the fields are cleared. This is so
because the behaviors I was using (AjaxFormChoiceComponentUpdatingBehavior
for the radios and OnChangeAjaxBehavior for the drop down choices) do not
submit the form when activated. Since I now set the whole form in the
AjaxRequestTarget, this causes the data clear problem, because the model is
not updated at the time the logic executes, and then the whole form comes
back to the browser discarding the values entered by the user.

So, I made a fix by using AjaxFormSubmitBehavior (with some modifications
because I don't want validations to get executed when a radio button is
selected, for instance).
But the real question is: am I on the right way? perhaps the original
problem with the hidden fields could have been solved in another, more
"standard" way?

Any help will be really appreciated.
Best regards,
Andrés

-- 
View this message in context: 
http://www.nabble.com/Invisible-fields-in-wicket-tp18069101p18069101.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to