So I have this page that I've had working with tomahawk subforms for awhile.

Now I'd like to change a couple of the subform submits into ajax
partial page submits instead of full page submits.

I'm a complete novice when it comes to using ajax -- I've managed to
do some trivial stuff with it on other pages, but nothing more
complicated than updating some status messages using a4j:poll.

My actual page is rather complicated: A form over the whole page.
Various input fields scattered over the page.   One text input
requires a trip to the server to update some displayed values.
Another pulldown wrapped in a subform adds/removes input fields.
Several buttons wrapped in subforms with no associated submitted
inputs which populate input field values.   Finally, one button which
submits all rendered input fields.

So I picked something I figured would be easy -- it's a pulldown that
determines which other input fields are rendered.  Here are the
stripped-down, sanitized tags -- there may be typos that do not exist
in the actual code.

                        <t:subform id="listboxForm">
                                <h:selectOneListbox
                                         value="#{page.newListboxValue}"
                                         >
                                        <f:selectItems
                                                value="#{page.listboxItems}"/>
                                        <sandbox:submitOnEvent 
for="executeListboxChangeButton" />
                                </h:selectOneListbox>
                                <t:commandButton id="executeListboxChangeButton"
                                        style="display: none"
                                        actionFor="listboxForm"
                                        value="Go!">
                                </t:commandButton>
                        </t:subform>

My first thought was I could add the following to t:commandButton:

<a4j:support event="onclick" disableDefault="true" reRender="area1,area2" />


Then I tried dropping the subform, submitOnEvent, and commandButton
and using ajaxsingle=true:

                                <h:selectOneListbox
                                         value="#{page.newListboxValue}"
                                         >
                                        <f:selectItems
                                                value="#{page.listboxItems}"/>
                                        <a4j:support ajaxSingle="true" 
event="onchange" reRender="area1,area2" />
                                </h:selectOneListbox>

None of these seem to trigger the partial submit.

I'm probably misunderstanding something fundamental.   Any help is appreciated.

Reply via email to