The code is already in place to set the hidden field to the correct value when the form is submitted.
On Sat, Mar 22, 2008 at 11:59 AM, Adam Zimowski <[EMAIL PROTECTED]> wrote: > 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] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]