[jira] [Commented] (OFBIZ-5279) Wrong to use !jQuery('#content-messages') in \framework\images\webapp\images\selectall.js line #354

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

[jira] [Commented] (OFBIZ-5279) Wrong to use !jQuery('#content-messages') in \framework\images\webapp\images\selectall.js line #354

Nicolas Malin (Jira)

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

Wei Zhang commented on OFBIZ-5279:
----------------------------------

Yes, I tested. and I think we also need to change line #371. So the correct function should be
{code}
function ajaxSubmitFormUpdateAreas(form, areaCsvString) {
   waitSpinnerShow();
   hideErrorContainer = function() {
                jQuery('#content-messages').html('');
       jQuery('#content-messages').removeClass('errorMessage').fadeIn('fast');
   }
   updateFunction = function(data) {
       if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) {
           if (!jQuery('#content-messages').length) {
              //add this div just after app-navigation
              if(jQuery('#content-main-section')){
                  jQuery('#content-main-section' ).before('<div id="content-messages" onclick="hideErrorContainer()"></div>');
              }
           }
           jQuery('#content-messages').addClass('errorMessage');
          if (data._ERROR_MESSAGE_LIST_ != undefined && data._ERROR_MESSAGE_ != undefined) {
              jQuery('#content-messages' ).html(data._ERROR_MESSAGE_LIST_ + " " + data._ERROR_MESSAGE_);
          } else if (data._ERROR_MESSAGE_LIST_ != undefined) {
              jQuery('#content-messages' ).html(data._ERROR_MESSAGE_LIST_);
          } else {
              jQuery('#content-messages' ).html(data._ERROR_MESSAGE_);
          }
          jQuery('#content-messages').fadeIn('fast');
       }else {
           if(jQuery('#content-messages').length) {
                           jQuery('#content-messages').html('');
               jQuery('#content-messages').removeClass('errorMessage').fadeIn("fast");
           }
           ajaxUpdateAreas(areaCsvString);
       }
       waitSpinnerHide();
   }

   jQuery.ajax({
       type: "POST",
       url: jQuery("#" + form).attr("action"),
       data: jQuery("#" + form).serialize(),
       success: function(data) {
               updateFunction(data);
       }
   });
}
{code}
               

> Wrong to use !jQuery('#content-messages') in \framework\images\webapp\images\selectall.js line #354
> ---------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-5279
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5279
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Wei Zhang
>
> I think we should use
> if(jQuery('#content-messages').length==0)
> insead of
> if(!jQuery('#content-messages'))
> in framework\images\webapp\images\selectall.js line #354.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira