Author: sascharodekamp
Date: Sun Apr 17 12:52:54 2011
New Revision: 1094138
URL:
http://svn.apache.org/viewvc?rev=1094138&view=revLog:
Improvement: Enables the jQuery validation plugin for all macro generted forms if min one field has the widget-style required.
Modified:
ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1094138&r1=1094137&r2=1094138&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Sun Apr 17 12:52:54 2011
@@ -300,7 +300,15 @@ ${item.description}</span>
<#macro renderFormClose focusFieldName formName>
</form><#lt/>
<#if focusFieldName?has_content>
- <script language="JavaScript" type="text/javascript">document.${formName}.${focusFieldName}.focus();</script><#lt/>
+ <script language="JavaScript" type="text/javascript">
+ var form = document.${formName};
+ form.${focusFieldName}.focus();
+ <#-- enable the validation plugin for all generated forms
+ only enable the validation if min one field is marked as 'required' -->
+ if (jQuery(form).find(".required").size() > 0) {
+ jQuery(form).validate();
+ }
+ </script><#lt/>
</#if>
</#macro>
<#macro renderMultiFormClose>