You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/06/20 13:18:37 UTC

svn commit: r956346 - in /click/trunk/click: documentation/docs/roadmap-changes.html examples/src/org/apache/click/examples/page/control/SubmitLinkDemo.java extras/src/org/apache/click/extras/control/SubmitLink.java

Author: sabob
Date: Sun Jun 20 11:18:37 2010
New Revision: 956346

URL: http://svn.apache.org/viewvc?rev=956346&view=rev
Log:
Fixed SubmitLink to use formId instead of formName. CLK-701

Modified:
    click/trunk/click/documentation/docs/roadmap-changes.html
    click/trunk/click/examples/src/org/apache/click/examples/page/control/SubmitLinkDemo.java
    click/trunk/click/extras/src/org/apache/click/extras/control/SubmitLink.java

Modified: click/trunk/click/documentation/docs/roadmap-changes.html
URL: http://svn.apache.org/viewvc/click/trunk/click/documentation/docs/roadmap-changes.html?rev=956346&r1=956345&r2=956346&view=diff
==============================================================================
--- click/trunk/click/documentation/docs/roadmap-changes.html (original)
+++ click/trunk/click/documentation/docs/roadmap-changes.html Sun Jun 20 11:18:37 2010
@@ -80,6 +80,15 @@ includes improved Ajax support and @Bind
   </dt>
   <dd>
       <div style="margin-left: -2em; margin-top: 1.5em; margin-bottom: 1em;">
+      <b>New examples:</b>
+      </div>
+      <ul style="padding: 0em; margin-left:0em;margin-bottom: 2em">
+        <li class="change">
+          Added an example FieldSeparator Control and example usage page
+          [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-544">CLK-544</a>].
+        </li>
+      </ul>
+      <div style="margin-left: -2em; margin-top: 1.5em; margin-bottom: 1em;">
         <b>New features and issues resolved:</b>
       </div>
       <ul style="padding: 0em; margin-left:0em;margin-bottom: 2em">
@@ -105,6 +114,10 @@ includes improved Ajax support and @Bind
               [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-681">CLK-681</a>].
           </li>
           <li class="change">
+              Fixed SubmitLink to use Form id instead of Form name
+              [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-701">CLK-701</a>].
+          </li>
+          <li class="change">
               Update to the latest version for some of the JARs dependencies: log4j-1.2.16, freemarker-2.3.16,
               commons-codec-1.4, and commons-lang-2.5.
           </li>
@@ -117,10 +130,6 @@ includes improved Ajax support and @Bind
               This issue was raised and fixed by Henry Saputra
               [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-636">CLK-636</a>].
           </li>
-          <li class="change">
-              Added an example FieldSeparator Control and example usage page 
-              [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-544">CLK-544</a>].
-          </li>
       </ul>
   </dd>
   <dt><a name="2.2.0"></a>

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/control/SubmitLinkDemo.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/control/SubmitLinkDemo.java?rev=956346&r1=956345&r2=956346&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/control/SubmitLinkDemo.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/control/SubmitLinkDemo.java Sun Jun 20 11:18:37 2010
@@ -151,7 +151,7 @@ public class SubmitLinkDemo extends Bord
 
         // Set custom JavaScript for the onclick event. The confirmSubmit function
         // is defined in the page template -> submit-link-demo.htm
-        String clickEvent = "return confirmSubmit(this, '" + form.getName() + "', 'Are you sure?');";
+        String clickEvent = "return confirmSubmit(this, '" + form.getId() + "', 'Are you sure?');";
         confirmationLink.setOnClick(clickEvent);
 
         // The Parametrized SubmitLink action listener

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/SubmitLink.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/SubmitLink.java?rev=956346&r1=956345&r2=956346&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/SubmitLink.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/SubmitLink.java Sun Jun 20 11:18:37 2010
@@ -83,8 +83,8 @@ import org.apache.commons.lang.StringUti
  *         SubmitLink link = new SubmitLink("link", "Delete");
  *         form.add(link);
  *
- *         // Get the submit script for the given form name
- *         String submitScript = submitLink.getSubmitScript(form.getName());
+ *         // Get the submit script for the given form id
+ *         String submitScript = submitLink.getSubmitScript(form.getId());
  *
  *         // Add a confirmation popup message
  *         scriptLink.setOnClick("var confirm = window.confirm('Are you sure?'); if (confirm) "
@@ -302,26 +302,26 @@ public class SubmitLink extends ActionLi
     }
 
     /**
-     * Return the JavaScript that submits the Form with the given formName.
+     * Return the JavaScript that submits the Form with the given formId.
      * <p/>
      * The script returned by this method is:
      *
      * <pre class="prettyprint">
-     * "return Click.submitLinkAction(this, 'formName');" </pre>
+     * "return Click.submitLinkAction(this, 'formId');" </pre>
      *
      * The <tt>Click.submitLinkAction</tt> function takes as parameters a reference
-     * to the SubmitLink and the name of the Form to submit. (The
+     * to the SubmitLink and the id of the Form to submit. (The
      * Click.submitLinkAction is defined in <tt>/click/extras-control.js</tt>)
      *
-     * @param formName the name of the Form to submit
+     * @param formId the id of the Form to submit
      *
-     * @return the JavaScript that submits the Form with the given formName
+     * @return the JavaScript that submits the Form with the given formId
      *
-     * @throws IllegalStateException if the form name is null
+     * @throws IllegalStateException if the form id is null
      */
-    public String getSubmitScript(String formName) {
-        if (formName == null) {
-            throw new IllegalStateException("formName cannot be null.");
+    public String getSubmitScript(String formId) {
+        if (formId == null) {
+            throw new IllegalStateException("formId cannot be null.");
         }
 
         HtmlStringBuffer buffer = new HtmlStringBuffer(60);
@@ -332,7 +332,7 @@ public class SubmitLink extends ActionLi
             buffer.append("_submit() &&");
         }
         buffer.append(" Click.submitLinkAction(this, '");
-        buffer.append(formName);
+        buffer.append(formId);
         buffer.append("');");
         return buffer.toString();
     }
@@ -347,6 +347,7 @@ public class SubmitLink extends ActionLi
      * @param value the SubmitLink value parameter
      * @return the SubmitLink HTML href attribute
      */
+    @Override
     public String getHref(Object value) {
         Context context = getContext();
         String uri = ClickUtils.getRequestURI(context.getRequest());
@@ -400,6 +401,7 @@ public class SubmitLink extends ActionLi
      * This method binds the submitted request value to the SubmitLink's
      * value.
      */
+    @Override
     public void bindRequestValue() {
         Context context = getContext();
 
@@ -452,6 +454,7 @@ public class SubmitLink extends ActionLi
      *
      * @return the list of HEAD elements to be included in the page
      */
+    @Override
     public List<Element> getHeadElements() {
         if (getForm() == null) {
             return super.getHeadElements();
@@ -474,13 +477,14 @@ public class SubmitLink extends ActionLi
      *
      * @param buffer the specified buffer to render the control's output to
      */
+    @Override
     public void render(HtmlStringBuffer buffer) {
 
         // Check that the link is attached to a Form and the onClick attribute
         // has not been set
         Form form = getForm();
         if (form != null && getOnClick() == null) {
-            setOnClick(getSubmitScript(form.getName()));
+            setOnClick(getSubmitScript(form.getId()));
         }
 
         super.render(buffer);