Anonymous avatar Anonymous committed 25d4664

Fixed WW-632. Added onclick attribute to all available tags and testsuite. Onclick is a HTML 4.0 compatible attr that can be used on most elements.

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@567 573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (13)

src/etc/taglib.tld

             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
+        <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
     </tag>
 
     <tag>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>show</name>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
+        <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
     </tag>
 
     <tag>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
+        <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
     </tag>
 
     <tag>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>headerKey</name>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
+        <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
     </tag>
 
     <tag>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
+        <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
     </tag>
 
     <tag>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
+        <attribute>
+            <name>onclick</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
     </tag>
 
     <tag>

src/java/com/opensymphony/webwork/views/jsp/ui/AbstractUITag.java

     protected String labelPositionAttr;
     protected String nameAttr;
     protected String onchangeAttr;
+    protected String onclickAttr;
     protected String requiredAttr;
     protected String tabindexAttr;
     protected String templateAttr;
         this.onchangeAttr = onchange;
     }
 
+    public void setOnclick(String onclick) {
+        this.onclickAttr = onclick;
+    }
+
     public void setRequired(String required) {
         this.requiredAttr = required;
     }
             addParameter("onchange", findString(onchangeAttr));
         }
 
+        if (onclickAttr != null) {
+            addParameter("onclick", findString(onclickAttr));
+        }
+
         if (cssClassAttr != null) {
             addParameter("cssClass", findString(cssClassAttr));
         }

src/java/template/simple/checkbox.vm

 #if ($parameters.disabled == true) disabled="disabled"                                      #end
 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
+#if ($parameters.onclick)          onclick="$!webwork.htmlEncode($parameters.onclick)"      #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"       #end
 #if ($parameters.cssStyle)         style="$!webwork.htmlEncode($parameters.cssStyle)"       #end

src/java/template/simple/combobox.vm

 #if ($parameters.onkeyup)          onkeyup="$!webwork.htmlEncode($parameters.onkeyup)"      #end
 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
+#if ($parameters.onclick)          onclick="$!webwork.htmlEncode($parameters.onclick)"      #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"       #end
 #if ($parameters.cssStyle)         style="$!webwork.htmlEncode($parameters.cssStyle)"       #end

src/java/template/simple/file.vm

 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.accept)           accept="$!webwork.htmlEncode($parameters.accept)"        #end
 #if ($parameters.onchange)         onchange="$!parameters.onchange"                         #end
+#if ($parameters.onclick)          onchange="$!parameters.onclick"                          #end
 #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"       #end
 #if ($parameters.cssStyle)         style="$!webwork.htmlEncode($parameters.cssStyle)"       #end
 />

src/java/template/simple/password.vm

 #if ($parameters.onkeyup)          onkeyup="$!webwork.htmlEncode($parameters.onkeyup)"      #end
 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
+#if ($parameters.onclick)          onclick="$!webwork.htmlEncode($parameters.onclick)"      #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"       #end
 />

src/java/template/simple/radiomap.vm

             #if ($parameters.disabled)  disabled="disabled"                                   #end
             #if ($parameters.tabindex)  tabindex="$!webwork.htmlEncode($parameters.tabindex)" #end
             #if ($parameters.onchange)  onchange="$!webwork.htmlEncode($parameters.onchange)" #end
+            #if ($parameters.onclick)   onclick="$!webwork.htmlEncode($parameters.onclick)"   #end
             #if ($parameters.cssClass)  class="$!webwork.htmlEncode($parameters.cssClass)"    #end
             #if ($parameters.cssStyle)  style="$!webwork.htmlEncode($parameters.cssStyle)"    #end
         /><label for="$!webwork.htmlEncode($parameters.name)$!webwork.htmlEncode($itemKey)">$!itemValue</label>

src/java/template/simple/select.vm

     #if ($parameters.disabled)         disabled="disabled"                                  #end
     #if ($parameters.tabindex)         tabindex="$parameters.tabindex"                      #end
     #if ($parameters.onchange)         onchange="$parameters.onchange"                      #end
+    #if ($parameters.onclick)          onclick="$parameters.onclick"                        #end
     #if ($parameters.id)               id="$parameters.id"                                  #end
     #if ($parameters.multiple)         multiple="multiple"                                  #end
     #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"   #end

src/java/template/simple/text.vm

 #if ($parameters.onkeyup)          onkeyup="$!webwork.htmlEncode($parameters.onkeyup)"      #end
 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
+#if ($parameters.onclick)          onclick="$!webwork.htmlEncode($parameters.onclick)"    #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"       #end
 #if ($parameters.cssStyle)         style="$!webwork.htmlEncode($parameters.cssStyle)"       #end

src/java/template/simple/textarea.vm

 #if ($parameters.onkeyup)          onkeyup="$!webwork.htmlEncode($parameters.onkeyup)"      #end
 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
+#if ($parameters.onclick)          onclick="$!webwork.htmlEncode($parameters.onclick)"      #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.cssClass)         class="$!webwork.htmlEncode($parameters.cssClass)"       #end
 #if ($parameters.cssStyle)         style="$!webwork.htmlEncode($parameters.cssStyle)"       #end

src/test/com/opensymphony/webwork/views/jsp/ui/Textarea-1.txt

                   onkeyup="alert('hello');"
                   tabindex="5"
                   onchange="alert('goodbye');"
+                  onclick="alert('onclick');"
                   id="the_id"
         >bar</textarea></td>
-</tr>
+</tr>

src/test/com/opensymphony/webwork/views/jsp/ui/TextareaTest.java

         tag.setDisabled("true");
         tag.setTabindex("'5'");
         tag.setOnchange("'alert(\\'goodbye\\');'");
+        tag.setOnclick("'alert(\\'onclick\\');'");
         tag.setId("the_id");
         tag.setOnkeyup("'alert(\\'hello\\');'");
         tag.setReadonly("true");

src/test/template/test/checkbox.jsp

     <webwork:if test="parameters['disabled']">disabled="disabled"</webwork:if>
     <webwork:if test="parameters['tabindex'] != null">tabindex="<webwork:property value="parameters['tabindex']"/>"</webwork:if>
     <webwork:if test="parameters['onchange'] != null">onchange="<webwork:property value="parameters['onchange']"/>"</webwork:if>
+    <webwork:if test="parameters['onclick'] != null">onclick="<webwork:property value="parameters['onclick']"/>"</webwork:if>
     <webwork:if test="parameters['id'] != null">id="<webwork:property value="parameters['id']"/>"</webwork:if>
 />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.