Revision: 550
http://svn.sourceforge.net/stripes/?rev=550&view=rev
Author: bengunter
Date: 2007-05-25 14:56:17 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Resolved STS-349. Applied a modified version of the patch submitted by Nicholas
Stuart to allow for partial forms.
Modified Paths:
--------------
trunk/stripes/resources/stripes.tld
trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java
Modified: trunk/stripes/resources/stripes.tld
===================================================================
--- trunk/stripes/resources/stripes.tld 2007-05-22 12:44:08 UTC (rev 549)
+++ trunk/stripes/resources/stripes.tld 2007-05-25 21:56:17 UTC (rev 550)
@@ -458,6 +458,14 @@
<description>Scripting code run prior to the form being submitted
to the server, (HTML Pass-through)</description>
<name>onsubmit</name><required>false</required><rtexprvalue>true</rtexprvalue>
</attribute>
+ <attribute>
+ <description>
+ Indicates whether or not to actually render the HTML
<FORM> tag and certain
+ hidden inputs, such as _sourcePage. This is useful when using
AJAX to insert
+ elements into an existing <FORM>.
+ </description>
+
<name>partial</name><required>false</required><rtexprvalue>true</rtexprvalue>
+ </attribute>
<!-- Start: Standard HTML attributes -->
<attribute><description>@class@</description><name>class</name><required>false</required><rtexprvalue>true</rtexprvalue></attribute>
Modified: trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java 2007-05-22
12:44:08 UTC (rev 549)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java 2007-05-25
21:56:17 UTC (rev 550)
@@ -52,6 +52,7 @@
/** Stores the field name (or magic values ''/'first') to set focus on. */
private String focus;
private boolean focusSet = false;
+ private boolean partial = false;
/** Stores the value of the action attribute before the context gets
appended. */
private String actionWithoutContext;
@@ -123,6 +124,10 @@
/** Gets the name of the field that should receive focus when the form is
rendered. */
public String getFocus() { return focus; }
+ /** Gets the flag that indicates if this is a partial form. */
+ public boolean isPartial() { return partial; }
+ /** Sets the flag that indicates if this is a partial form. */
+ public void setPartial(boolean partial) { this.partial = partial; }
////////////////////////////////////////////////////////////
// Additional attributes specific to the form tag
@@ -200,28 +205,32 @@
}
JspWriter out = getPageContext().getOut();
- writeOpenTag(out, "form");
+ if (!partial) {
+ writeOpenTag(out, "form");
+ }
getBodyContent().writeOut( getPageContext().getOut() );
- // Write out a hidden field with the name of the page in it....
- // The div is necessary in order to be XHTML compliant, where a
form can contain
- // only block level elements (which seems stupid, but whatever).
- out.write("<div style=\"display: none;\">");
- out.write("<input type=\"hidden\" name=\"");
- out.write(StripesConstants.URL_KEY_SOURCE_PAGE);
- out.write("\" value=\"");
- HttpServletRequest request = (HttpServletRequest)
getPageContext().getRequest();
- out.write( request.getServletPath());
- out.write("\" />");
+ if (!partial) {
+ // Write out a hidden field with the name of the page in it....
+ // The div is necessary in order to be XHTML compliant, where
a form can contain
+ // only block level elements (which seems stupid, but
whatever).
+ out.write("<div style=\"display: none;\">");
+ out.write("<input type=\"hidden\" name=\"");
+ out.write(StripesConstants.URL_KEY_SOURCE_PAGE);
+ out.write("\" value=\"");
+ HttpServletRequest request = (HttpServletRequest)
getPageContext().getRequest();
+ out.write(request.getServletPath());
+ out.write("\" />");
- if (isWizard()) {
- writeWizardFields();
- }
+ if (isWizard()) {
+ writeWizardFields();
+ }
- writeFieldsPresentHiddenField(out);
- out.write("</div>");
+ writeFieldsPresentHiddenField(out);
+ out.write("</div>");
- writeCloseTag(getPageContext().getOut(), "form");
+ writeCloseTag(getPageContext().getOut(), "form");
+ }
// Write out a warning if focus didn't find a field
if (this.focus != null && !this.focusSet) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development