blob: 5db303cc50e3b503e91015c941aec9bf6a97b037 [file] [log] [blame]
<html><head><title>tapestry.form</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body id=FramedContentPage onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div id=" + browserType + ">");if (browserVer) {document.write("<div id=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 02-10-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CClass CTopic" id=MainTopic><h1 class=CTitle><a name="tapestry.form"></a>tapestry.form</h1><div class=CBody><p class=CParagraph>Provides central handling of all client side form related logic.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBody><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#tapestry.form" >tapestry.form</a></td><td class=SDescription>Provides central handling of all client side form related logic.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#tapestry.form.Properties" >Properties</a></td><td class=SDescription></td></tr><tr class="SProperty SIndent2 SMarked"><td class=SEntry><a href="#tapestry.form.forms" >forms</a></td><td class=SDescription>Contains a reference to all registered Tapestry forms in the current document.</td></tr><tr class="SProperty SIndent2"><td class=SEntry><a href="#tapestry.form.currentFocus" >currentFocus</a></td><td class=SDescription>Reference to form element/element id of field that should currently recieve focus, if any</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#tapestry.form.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#tapestry.form.focusField" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">focusField</a></td><td class=SDescription>If possible, brings keyboard input focus to the specified field.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#tapestry.form.registerForm" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">registerForm</a></td><td class=SDescription>Registers the form with the local <a href="#tapestry.form.forms" class=LProperty id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">forms</a> property so that there is a central reference of all tapestry forms.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#tapestry.form.registerProfile" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">registerProfile</a></td><td class=SDescription>Registers a form validation/translation profile. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#tapestry.form.clearProfiles" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">clearProfiles</a></td><td class=SDescription>Clears any previously registered validation profiles on the specified form. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#tapestry.form.setFormValidating" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">setFormValidating</a></td><td class=SDescription>If a form registered with the specified formId exists a local property will be set that causes validation to be turned on/off depending on the argument.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#tapestry.form.submit" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">submit</a></td><td class=SDescription>Submits the form specified, optionally setting the submitname hidden input field to the value of submitName to let the Form component on server know which button caused the submission. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#tapestry.form.cancel" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">cancel</a></td><td class=SDescription>Submits the form to the server in &ldquo;cancel&rdquo; mode, invoking any cancel listeners registered to the server side equivalent to the form passed in.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#tapestry.form.refresh" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">refresh</a></td><td class=SDescription>Submits the form to the server in &ldquo;refresh&rdquo; mode, invoking any refresh listeners registered to the server side equivalent to the form passed in.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#tapestry.form.submitAsync" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">submitAsync</a></td><td class=SDescription>Does almost the same thing as <a href="#tapestry.form.submit" class=LFunction id=link11 onMouseOver="ShowTip(event, 'tt7', 'link11')" onMouseOut="HideTip('tt7')">tapestry.form.submit</a>, but submits the request via XHR to the server asynchronously.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div>
<div class="CGroup CTopic"><h3 class=CTitle><a name="tapestry.form.Properties"></a>Properties</h3></div>
<div class="CProperty CTopic"><h3 class=CTitle><a name="tapestry.form.forms"></a>forms</h3><div class=CBody><p class=CParagraph>Contains a reference to all registered Tapestry forms in the current document.</p></div></div>
<div class="CProperty CTopic"><h3 class=CTitle><a name="tapestry.form.currentFocus"></a>currentFocus</h3><div class=CBody><p class=CParagraph>Reference to form element/element id of field that should currently recieve focus, if any</p></div></div>
<div class="CGroup CTopic"><h3 class=CTitle><a name="tapestry.form.Functions"></a>Functions</h3></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.focusField"></a>focusField</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>focusField:function(</td><td class=PParameter nowrap>field</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>If possible, brings keyboard input focus to the specified field.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>field</td><td class=CDLDescription>The field(field id) of the field to focus.</td></tr></table><h4 class=CHeading>Note</h4><p class=CParagraph>Function deprecated in favor of dojo equivalent, like dojo.html.selectInputText(node).</p></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.registerForm"></a>registerForm</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>registerForm:function(</td><td class=PParameter nowrap>id,</td></tr><tr><td></td><td class=PParameter nowrap>async,</td></tr><tr><td></td><td class=PParameter nowrap>json</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Registers the form with the local <a href="#tapestry.form.forms" class=LProperty id=link12 onMouseOver="ShowTip(event, 'tt3', 'link12')" onMouseOut="HideTip('tt3')">forms</a> property so that there is a central reference of all tapestry forms.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>The form(form id) to register.</td></tr><tr><td class=CDLEntry>async</td><td class=CDLDescription>Boolean, if true causes form submission to be asynchronous.</td></tr><tr><td class=CDLEntry>json</td><td class=CDLDescription>Boolean, if true causes form submission to be asyncrhronous with an expected JSON response.</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.registerProfile"></a>registerProfile</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>registerProfile:function(</td><td class=PParameter nowrap>id,</td></tr><tr><td></td><td class=PParameter nowrap>profile</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Registers a form validation/translation profile.&nbsp; There can potentially be more than one profile registered with a form.</p><p class=CParagraph>The profiles will be consulted at various points in the forms life, which currently only involves running the profile checks before form submission.&nbsp; (more points to be determined in the future)</p><h4 class=CHeading>See Also</h4><p class=CParagraph>&lt;dojo.validate.check&gt;</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>The form(form id) to register profile with.</td></tr><tr><td class=CDLEntry>profile</td><td class=CDLDescription>The object containing all of the validation/value constraints for the form.</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.clearProfiles"></a>clearProfiles</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>clearProfiles:function(</td><td class=PParameter nowrap>id</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Clears any previously registered validation profiles on the specified form.&nbsp; Normally called during XHR requests by returned JS response to ensure new validation logic coming in from potentially new form fields is accounted for.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>The form id to clear profiles for.</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.setFormValidating"></a>setFormValidating</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>setFormValidating:function(</td><td class=PParameter nowrap>formId,</td></tr><tr><td></td><td class=PParameter nowrap>validate</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>If a form registered with the specified formId exists a local property will be set that causes validation to be turned on/off depending on the argument.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>formId</td><td class=CDLDescription>The id of the form to turn validation on/off for.</td></tr><tr><td class=CDLEntry>validate</td><td class=CDLDescription>Boolean for whether or not to validate form, if not specified assumes true.</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.submit"></a>submit</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>submit:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Submits the form specified, optionally setting the submitname hidden input field to the value of submitName to let the Form component on server know which button caused the submission.&nbsp; (For the case of submit button listeners).</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>form</td><td class=CDLDescription>The form(form id) to submit.</td></tr><tr><td class=CDLEntry>submitName</td><td class=CDLDescription>Optional submit name string to use when submitting.&nbsp; This is used to associate a form submission with a particular component, like a Submit/LinkSubmit/etc..</td></tr><tr><td class=CDLEntry>parms</td><td class=CDLDescription>Optional extra set of arguments that can control the form submission semantics such as url/async/json/etc.</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.cancel"></a>cancel</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>cancel:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Submits the form to the server in &ldquo;cancel&rdquo; mode, invoking any cancel listeners registered to the server side equivalent to the form passed in.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>form</td><td class=CDLDescription>The form(form id) to cancel.</td></tr><tr><td class=CDLEntry>submitName</td><td class=CDLDescription>Optional submit name string to use when submitting.&nbsp; This is used to associate a form submission with a particular component, like a Submit/LinkSubmit/etc..</td></tr><tr><td class=CDLEntry>parms</td><td class=CDLDescription>Optional object parms passed through to tapestry.form.submit().</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.refresh"></a>refresh</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>refresh:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Submits the form to the server in &ldquo;refresh&rdquo; mode, invoking any refresh listeners registered to the server side equivalent to the form passed in.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>form</td><td class=CDLDescription>The form(form id) to refresh.</td></tr><tr><td class=CDLEntry>submitName</td><td class=CDLDescription>Optional submit name string to use when submitting.&nbsp; This is used to associate a form submission with a particular component, like a Submit/LinkSubmit/etc..</td></tr><tr><td class=CDLEntry>parms</td><td class=CDLDescription>Optional object parms passed through to tapestry.form.submit().</td></tr></table></div></div>
<div class="CFunction CTopic"><h3 class=CTitle><a name="tapestry.form.submitAsync"></a>submitAsync</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>submitAsync:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>content,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p class=CParagraph>Does almost the same thing as <a href="#tapestry.form.submit" class=LFunction id=link13 onMouseOver="ShowTip(event, 'tt7', 'link13')" onMouseOut="HideTip('tt7')">tapestry.form.submit</a>, but submits the request via XHR to the server asynchronously.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>form</td><td class=CDLDescription>The form(form id) to submit.</td></tr><tr><td class=CDLEntry>content</td><td class=CDLDescription>Optional content map, mainly used to pass in browser event parameters to form submission, but can be any typical form/value pair.</td></tr><tr><td class=CDLEntry>submitName</td><td class=CDLDescription>Optional submit name string to use when submitting.</td></tr><tr><td class=CDLEntry>parms</td><td class=CDLDescription>Optional set of extra parms that can override the defautls for this specific form submission, like the url/async/json behaviour of the submission.</td></tr></table></div></div>
</div><!--Content-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>focusField:function(</td><td class=PParameter nowrap>field</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>If possible, brings keyboard input focus to the specified field.</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>registerForm:function(</td><td class=PParameter nowrap>id,</td></tr><tr><td></td><td class=PParameter nowrap>async,</td></tr><tr><td></td><td class=PParameter nowrap>json</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Registers the form with the local forms property so that there is a central reference of all tapestry forms.</div></div><div class=CToolTip id="tt3"><div class=CProperty>Contains a reference to all registered Tapestry forms in the current document.</div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>registerProfile:function(</td><td class=PParameter nowrap>id,</td></tr><tr><td></td><td class=PParameter nowrap>profile</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Registers a form validation/translation profile. </div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>clearProfiles:function(</td><td class=PParameter nowrap>id</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Clears any previously registered validation profiles on the specified form. </div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>setFormValidating:function(</td><td class=PParameter nowrap>formId,</td></tr><tr><td></td><td class=PParameter nowrap>validate</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>If a form registered with the specified formId exists a local property will be set that causes validation to be turned on/off depending on the argument.</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>submit:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Submits the form specified, optionally setting the submitname hidden input field to the value of submitName to let the Form component on server know which button caused the submission. </div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>cancel:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Submits the form to the server in &ldquo;cancel&rdquo; mode, invoking any cancel listeners registered to the server side equivalent to the form passed in.</div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>refresh:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Submits the form to the server in &ldquo;refresh&rdquo; mode, invoking any refresh listeners registered to the server side equivalent to the form passed in.</div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>submitAsync:function(</td><td class=PParameter nowrap>form,</td></tr><tr><td></td><td class=PParameter nowrap>content,</td></tr><tr><td></td><td class=PParameter nowrap>submitName,</td></tr><tr><td></td><td class=PParameter nowrap>parms</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Does almost the same thing as tapestry.form.submit, but submits the request via XHR to the server asynchronously.</div></div><!--END_ND_TOOLTIPS-->
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>