I would need a quick start to see where it is going wrong.
-Matej
On Wed, Sep 10, 2008 at 7:26 PM, German Morales
<[EMAIL PROTECTED]> wrote:
> Investigating a little more, my problem seems to be caused by
> AjaxFormSubmitBehavior#onEvent
>
> protected void onEvent(AjaxRequestTarget target) {
> getForm().getRootForm().onFormSubmitted();
>
> which calls onFormSubmitted on the RootForm, and not in the Form i've passed
> to my AjaxSubmitLink.
>
> could someone explain me why it does that?
>
> In fact, overriding onEvent to call onFormSubmitted on getForm() and not in
> the root form solves my problems... but am i breaking something else?
>
> Thanks,
>
> German
>
>
> 2008/9/9 German Morales <[EMAIL PROTECTED]>
>
>> Hi Matej,
>>
>> Thanks for the answer.
>>
>> I have an AjaxSubmitLink both for opening and closing the modal window.
>> Should that make any trouble?
>> In both cases i have data to persist, so it must be a .*Submit.* component.
>>
>> Also, my problem happens when closing the window, not when opening it.
>> I summarize it again:
>> -the browser sends an ajax call with the values in the modal window
>> -but on wicket side the main form of the page is the one that takes charge
>> -the components on the page then receive the new input, but there's
>> actually nothing coming from the browser for them
>> -some components (text components) handle it well, some not (checkbox,
>> dropdownchoice).
>> -the misbehaving component get a rawinput of null instead of NO_RAW_INPUT,
>> which then produces the side effect that the component does not get the
>> value from the model on rendering.
>>
>> Please see the doubts section at the end of the original e-mail.
>>
>> Thanks again,
>>
>> German
>>
>> 2008/9/9 Matej Knopp <[EMAIL PROTECTED]>
>>
>> The link that shows the modal window must be AjaxButton/SubmitLink.
>>>
>>> -Matej
>>>
>>> On Tue, Sep 9, 2008 at 11:20 PM, German Morales
>>> <[EMAIL PROTECTED]> wrote:
>>> > Hi all,
>>> >
>>> > I've a problem with Forms and ModalWindows.
>>> >
>>> > I have this stuff:
>>> > -a page with a main Form (the only one that is rendered as an HTML form
>>> tag)
>>> > -this my only page, since all inside it is changed by replacing panels
>>> using
>>> > ajax.
>>> > -inside some other levels of panels, i have a panel with my content (let
>>> me
>>> > call it myContentPanel), which has its own (sub) Form (which is rendered
>>> as
>>> > a div).
>>> > -myContentPanel has some controls... TextFields, DropDownChoices,
>>> > CheckBoxes.
>>> > -myContentPanel has also a link that opens a ModalWindow.
>>> > -the ModalWindow has its own Form with components, and an AjaxSubmitLink
>>> to
>>> > close it.
>>> >
>>> > Now the problem...
>>> > 1- I enter to myContentPanel and enter some values in the components.
>>> > 2- I press the link to open the ModalWindow.
>>> > 3- I work with the ModalWindow, then press an AjaxSubmitLink to close
>>> it.
>>> > 4- When refreshing myContentPanel, the values in some controls is lost:
>>> > CheckBoxes, DropDownChoices, but NOT in TextFields.
>>> >
>>> > After some investigation, this is what i've discovered:
>>> > -on step 3 (accept and close the ModalWindow), the AjaxSubmitLink calls
>>> > (javascript) wicketSubmitFormById passing the ModalWindow's form as
>>> > parameter.
>>> > -this processes the ModalWindow's form and prepares the values to be
>>> sent to
>>> > wicket side.
>>> > -but when i see the url, it mentions that the form that will be used for
>>> the
>>> > HTTP request is the page's form (because it's the only real form, i
>>> think
>>> > this is normal).
>>> > -on wicket side, the request processing calls Form#onFormSubmitted,
>>> which
>>> > calls #inputChanged, which calls a visitor visiting all components... in
>>> the
>>> > main form!
>>> > -this ends up calling FormComponent#inputChanged on the CheckBoxes,
>>> > DropDownChoices, TextFields that where in myContentPanel (also for the
>>> > controls in the ModalWindow, but that's no surprise).
>>> > -given that the javascript only prepared the data for the ModalWindow's
>>> > form, the values for the components in myContentPanel is empty.
>>> > -looking deeper in #inputChanged, getInputAsArray() gives null for the
>>> > components in myContentPanel.
>>> > -then, since CheckBox and DropDownChoice answer true to
>>> isInputNullable()
>>> > (default in FormComponent), the rawInput is set to null, even if i
>>> didn't
>>> > touch the CheckBoxes/DropDownChoices at all in this call (then losing
>>> the
>>> > previous value: NO_RAW_INPUT).
>>> > -on step 4, when the CheckBox/DropDownChoice wants to get rendered
>>> again,
>>> > onComponentTag calls FormComponent#getValue, which if
>>> > (NO_RAW_INPUT.equals(rawInput)) uses the Model to get the value (what i
>>> > would expect), but in my case returns the rawInput (null... ouch).
>>> >
>>> > I have fixed it temporaly by overriding isInputNullable in my
>>> > CheckBoxes/DropDownChoice, but i understand that this is not a very good
>>> > solution.
>>> >
>>> > Some doubts that remain:
>>> > -is there anything wrong with my structure of forms and panels, which is
>>> > actually producing these side effects?
>>> > -if only the values for ModalWindow form are sent to the server, why the
>>> is
>>> > onFormSubmitted called on the main page form?
>>> > -the javadoc in isInputNullable is not very clear for me... do i break
>>> > something else if i override isInputNullable answering false?
>>> >
>>> > Thanks in advance,
>>> >
>>> > German
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]