Commits

Anonymous committed d85d1a2

WW-1440
- Multiple forms cause conflicting customOnSubmit() functions to be created

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

Comments (0)

Files changed (18)

src/java/template/css_xhtml/form-validate.ftl

 <#if parameters.validate?default(false) == true>
 <script type="text/javascript" src="${base}/webwork/css_xhtml/validation.js" type="text/javascript"></script>
     <#if parameters.onsubmit?exists>
-        ${tag.addParameter('onsubmit', "${parameters.onsubmit}; customOnsubmit(); return validateForm_${parameters.id}();")}
+        ${tag.addParameter('onsubmit', "${parameters.onsubmit}; customOnsubmit_${parameters.id}(); return validateForm_${parameters.id}();")}
     <#else>
-        ${tag.addParameter('onsubmit', "customOnsubmit(); return validateForm_${parameters.id}();")}
+        ${tag.addParameter('onsubmit', "customOnsubmit_${parameters.id}(); return validateForm_${parameters.id}();")}
     </#if>
 </#if>

src/java/template/simple/form-close.ftl

 
 
 <script type="text/javascript">
-	function customOnsubmit() {
+	function customOnsubmit_${parameters.id}() {
 	<#-- 
 	   Code that will auto-select optiontransferselect elements upon containing form submission
 	--><#t/>

src/java/template/simple/form.ftl

 <#if (parameters.validate?default(false) == false)><#rt/>
 	<#if parameters.onsubmit?exists><#rt/>
-		${tag.addParameter('onsubmit', "${parameters.onsubmit}; customOnsubmit(); return true;") }
+		${tag.addParameter('onsubmit', "${parameters.onsubmit}; customOnsubmit_${parameters.id}(); return true;") }
 	<#else>
-		${tag.addParameter('onsubmit', "customOnsubmit(); return true;") }	
+		${tag.addParameter('onsubmit', "customOnsubmit_${parameters.id}(); return true;") }	
 	</#if>
 </#if>
 <form<#rt/>

src/java/template/xhtml/form-validate.ftl

 <#if parameters.validate?default(false) == true>
 	<script type="text/javascript" src="${base}/webwork/xhtml/validation.js"></script>
 	<#if parameters.onsubmit?exists>
-		${tag.addParameter('onsubmit', "${parameters.onsubmit}; customOnsubmit(); return validateForm_${parameters.id}();")}
+		${tag.addParameter('onsubmit', "${parameters.onsubmit}; customOnsubmit_${parameters.id}(); return validateForm_${parameters.id}();")}
 	<#else>
-		${tag.addParameter('onsubmit', "customOnsubmit(); return validateForm_${parameters.id}();")}
+		${tag.addParameter('onsubmit', "customOnsubmit_${parameters.id}(); return validateForm_${parameters.id}();")}
 	</#if>
 </#if>

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

-<form id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit(); return true;" action="myAction" method="POST" enctype="myEncType" title="mytitle">
+<form id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit_myAction(); return true;" action="myAction" method="POST" enctype="myEncType" title="mytitle">
 <table class="wwFormTable">
 </table>
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() {}
+	function customOnsubmit_myAction() {}
 </script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-10.txt

-<form id="testNamespaceAction" name="myForm" onsubmit="submitMe(); customOnsubmit(); return true;" action="/testNamespace/testNamespaceAction!myLittleMethod.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
+<form id="testNamespaceAction" name="myForm" onsubmit="submitMe(); customOnsubmit_testNamespaceAction(); return true;" action="/testNamespace/testNamespaceAction!myLittleMethod.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
 <table class="wwFormTable">
 </table>
 </form>
 
-<script type="text/javascript">functioncustomOnsubmit(){}</script>
+<script type="text/javascript">functioncustomOnsubmit_testNamespaceAction(){}</script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-11.txt

 <script type="text/javascript" src="/webwork/xhtml/validation.js"></script>
-<form namespace="" id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit(); return validateForm_myAction();" action="/myAction.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
+<form namespace="" id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit_myAction(); return validateForm_myAction();" action="/myAction.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
 <table class="wwFormTable"> <tr>
     <td class="tdLabel"></td>
     <td>	<script type="text/javascript" language="javascript" src="/webwork/optiontransferselect/optiontransferselect.js"></script>
 </table>
 </form>
 
-<script type="text/javascript">functioncustomOnsubmit(){//CodethatwillautoselectupdownselectelementsuponitscontainingformsubmissionvarupdownselectObj=document.getElementById("myAction_myUpDownSelectTag");selectAllOptions(updownselectObj);selectUnselectMatchingOptions(updownselectObj,null,"unselect",false,"key");}</script>
+<script type="text/javascript">functioncustomOnsubmit_myAction(){//CodethatwillautoselectupdownselectelementsuponitscontainingformsubmissionvarupdownselectObj=document.getElementById("myAction_myUpDownSelectTag");selectAllOptions(updownselectObj);selectUnselectMatchingOptions(updownselectObj,null,"unselect",false,"key");}</script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-2.txt

 <script type="text/javascript" src="/webwork/xhtml/validation.js"></script>
-<form namespace="" id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit(); return validateForm_myAction();" action="/myAction.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
+<form namespace="" id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit_myAction(); return validateForm_myAction();" action="/myAction.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
 <table class="wwFormTable"> <tr>
     <td class="tdLabel"></td>
     <td>	<script type="text/javascript" language="javascript" src="/webwork/optiontransferselect/optiontransferselect.js"></script>
 
 
 <script type="text/javascript">
-	function customOnsubmit() {
+	function customOnsubmit_myAction() {
 
 		// Code that will auto select updownselect elements upon its containing form submission
 			var updownselectObj = document.getElementById("myAction_myUpDownSelectTag");

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-3.txt

-<form id="testNamespaceAction" name="myForm" onsubmit="customOnsubmit(); return true;" action="/testNamespace/testNamespaceAction.action" method="POST">
+<form id="testNamespaceAction" name="myForm" onsubmit="customOnsubmit_testNamespaceAction(); return true;" action="/testNamespace/testNamespaceAction.action" method="POST">
 <table class="wwFormTable">
 </table>
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() {}
+	function customOnsubmit_testNamespaceAction() {}
 </script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-4.txt

-<form id="foo" onsubmit="customOnsubmit(); return true;" action="/foo.jsp">
+<form id="foo" onsubmit="customOnsubmit_foo(); return true;" action="/foo.jsp">
 <table class="wwFormTable">
 </table>
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() {}
+	function customOnsubmit_foo() {}
 </script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-5.txt

-<form id="testNamespaceAction" name="myForm"onsubmit="customOnsubmit(); return true;" action="/testNamespace/testNamespaceAction.jspa" method="POST">
+<form id="testNamespaceAction" name="myForm"onsubmit="customOnsubmit_testNamespaceAction(); return true;" action="/testNamespace/testNamespaceAction.jspa" method="POST">
 <table class="wwFormTable">
 </table>
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() {}
+	function customOnsubmit_testNamespaceAction() {}
 </script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-6.txt

-<form namespace="" id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit(); return true;" action="myAction" method="POST" enctype="myEncType" title="mytitle">
+<form namespace="" id="myAction" name="myForm" onsubmit="submitMe(); customOnsubmit_myAction(); return true;" action="myAction" method="POST" enctype="myEncType" title="mytitle">
 <table class="wwFormTable"> <tr>
     <td class="tdLabel"></td>
     <td>	<script type="text/javascript" language="javascript" src="/webwork/optiontransferselect/optiontransferselect.js"></script>
 
 
 <script type="text/javascript">
-	function customOnsubmit() {
+	function customOnsubmit_myAction() {
 
 		// Code that will auto select updownselect elements upon its containing form submission
 			var updownselectObj = document.getElementById("myAction_myUpDownSelectTag");

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-7.txt

-<form id="test" onsubmit="customOnsubmit(); return true;" action="test.html">
+<form id="test" onsubmit="customOnsubmit_test(); return true;" action="test.html">
 <table class="wwFormTable">
 </table>
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() {}
+	function customOnsubmit_test() {}
 </script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-8.txt

-<form id="testNamespaceAction" name="myForm"onsubmit="customOnsubmit(); return true;" action="/testNamespace/testNamespaceAction.jspa" method="POST">
+<form id="testNamespaceAction" name="myForm"onsubmit="customOnsubmit_testNamespaceAction(); return true;" action="/testNamespace/testNamespaceAction.jspa" method="POST">
 <table class="wwFormTable">
 </table>
 </form>
 
 <script type="text/javascript">
-function customOnsubmit() {}
+function customOnsubmit_testNamespaceAction() {}
 </script>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-9.txt

-<form id="testAction" name="myForm" onsubmit="submitMe(); customOnsubmit(); return true;" action="/testAction!myLittleMethod.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
+<form id="testAction" name="myForm" onsubmit="submitMe(); customOnsubmit_testAction(); return true;" action="/testAction!myLittleMethod.action" method="POST" enctype="myEncType" title="mytitle" accept-charset="UTF-8">
 <table class="wwFormTable">
 </table>
 </form>
 
-<script type="text/javascript">functioncustomOnsubmit(){}</script>
+<script type="text/javascript">functioncustomOnsubmit_testAction(){}</script>

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

-<form id="myFormId" name="myForm" onsubmit="customOnsubmit(); return true;" action="/testAction.action">
+<form id="myFormId" name="myForm" onsubmit="customOnsubmit_myFormId(); return true;" action="/testAction.action">
  <table class="wwFormTable"> 
 <tr>
     <td class="tdLabel"><label for="myId" class="label">MyLabel:
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() { }
+	function customOnsubmit_myFormId() { }
 </script>
 
 <!-- javascript that is needed for tooltips -->

src/test/com/opensymphony/webwork/views/jsp/ui/tooltip-2.txt

-<form id="myFormId" name="myForm" onsubmit="customOnsubmit(); return true;" action="/testAction.action">
+<form id="myFormId" name="myForm" onsubmit="customOnsubmit_myFormId(); return true;" action="/testAction.action">
  <table class="wwFormTable"> 
 <tr>
     <td class="tdLabel"><label for="myId" class="label">MyLabel:
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() { }
+	function customOnsubmit_myFormId() { }
 </script>
 
 <!-- javascript that is needed for tooltips -->

src/test/com/opensymphony/webwork/views/jsp/ui/tooltip-3.txt

-<form id="myFormId" name="myForm" onsubmit="customOnsubmit(); return true;" action="/testAction.action">
+<form id="myFormId" name="myForm" onsubmit="customOnsubmit_myFormId(); return true;" action="/testAction.action">
  <table class="wwFormTable"> 
 <tr>
     <td class="tdLabel"><label for="myId" class="label">MyLabel:
 </form>
 
 <script type="text/javascript">
-	function customOnsubmit() { }
+	function customOnsubmit_myFormId() { }
 </script>
 
 <!-- javascript that is needed for tooltips -->
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.