Per documentation, FormFragment decides if its content should be
submitted based on the hidden field [formfragmentname]:hidden:

// this is the relevant code from FormFragment source: void beginRender(..)
        writer.element("input",

                       "type", "hidden",

                       "name", _controlName,

                       "id", _clientId + ":hidden",

                       "value", String.valueOf(_visible));
        writer.end();


However, that field being generated at render time is fairly static,
which defeats the very purpose of dynamic behavior provided by
Tapestry.ElementEffect sidedown/slideup functions. The problem is that
when the silide function is invoked on the client (triggered by click
on the checkbox), that inherently means that FormFragment should be
submitted, but it won't be if the hidden field was generated with
false value.

The solution to this problem should be Tapestry dynamically changing
hidden field's value to true/false based on the client side state of
the checkbox tied to the FormFragment. For those who need a
workaround, I can share mine. In onclick of submit button one can
execute the following function:

function setupFragment(fragment, checkbox) {
 var checked = document.getElementById(checkbox).value;
 var advanced = (checked == 'on');
 document.getElementById(fragment + ':hidden').value=advanced;
}


<input t:id="submitButton"
onclick="setupFragment('advancedFragment','advancedCheckbox');"
type="submit" t:type="submit" value="Submit"/>

I believe this should be one of those "plumbing" tasks that Tapestry
should do for us. Should this be a JIRA improvement, or am I missing
something?

-adam

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

Reply via email to