[jira] [Commented] (OFBIZ-6690) replace widget-style="required" with required-field="true"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-6690) replace widget-style="required" with required-field="true"

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-6690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14966509#comment-14966509 ]

Taher Alkhateeb commented on OFBIZ-6690:
----------------------------------------

Okay, so on another search in the entire framework I see the following:

||item||count in code||
|required-field="true"|62|
|widget-style="required"|140|

so this means most of the required fields are enforced with the widget-style format instead of the required-field format. I can also see something like the below code snippet which I think only happens in the required-field, not the styled one.

So the question I have now is why do we have two ways of showing a field as required, and shouldn't we remove one of the two completely from the code base for consistency's sake? What do you think?

{code}
<#macro renderFormClose focusFieldName formName containerId hasRequiredField>
  </form><#lt/>
  <#if focusFieldName?has_content>
    <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>
  <#if containerId?has_content && hasRequiredField?has_content>
    <script type="text/javascript">
      jQuery("#${containerId}").validate({
        submitHandler:
          function(form) {
            form.submit();
          }
      });
    </script>
  </#if>
</#macro>
{code}

> replace widget-style="required" with required-field="true"
> ----------------------------------------------------------
>
>                 Key: OFBIZ-6690
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6690
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: ALL APPLICATIONS
>    Affects Versions: Trunk
>            Reporter: Pierre Smits
>              Labels: validation
>         Attachments: OFBIZ-6690-SetupForms.xml.patch, OFBIZ-6690-removewidgetstyle.patch
>
>
> Currently many fields have 'widget-style="required" to indicate that input for the field is required. Better is it to have 'required-field="true". This not only opens up the possibility to define additional validation rules, but the rendered also incorporates the aspects associated with 'widget-style="required".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)