本文介绍了从 Sugarcrm 中的 QuickCreate 中删除必填字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个函数来从 Contacts QuickCreate 中删除帐户名称相关字段,但我的函数在 Firefox 中完美运行,但在 chrome 中它不起作用......这是我的函数

I wrote a function to remove accounts name relate field from Contacts QuickCreate but my function works in Firefox perfectly but in chrome its not working... Here is my function

function manageRequired(reqArr, disabledVal)
{
    var requiredLabel = '<span class="required">*</span>'; // for firefox
    var search_requiredLabel = '<span class="required"'; // searching string for firefox
    var form = "";

    for(var i = 0; i < document.forms.length; i++)
    {
        if(document.forms[i].id=='EditView')
        {
            form = 'EditView';
            break;
        }
        if(document.forms[i].id=='form_SubpanelQuickCreate_Contacts')
        {
            form = 'form_SubpanelQuickCreate_Contacts';
            break;
            }
        if(document.forms[i].id=='form_QuickCreate_Contacts')
        {
            form = 'form_QuickCreate_Contacts';
            break;
            }
        if(document.forms[i].id=='form_QuickCreate_Accounts')
        {
            form = 'form_QuickCreate_Accounts';
            break;
            }
    }
    for(var j = 0; j < reqArr.length; j++)
    {
        var flag = true;
        if (validate[form] != 'undefined') 
        {
            for(var i = 0; i < validate[form].length; i++)
            {
                if(validate[form][i][0] == reqArr[j].id && validate[form][i][2])
                {
                    if(disabledVal)
                    {
                        flag = false;
                        break;
                    }
                    else
                    {
                        validate[form][i][2] = false;
                    }
                }
            }
        }
        var labelNode = document.getElementById(reqArr[j].id + '_label');
        if(flag & disabledVal)
        {
            // we require the field now
            addToValidate(form, reqArr[j].id, reqArr[j].type, true,reqArr[j].label );
        }
        if(disabledVal)
        {
            if(labelNode != null && labelNode.innerHTML.indexOf(search_requiredLabel) == -1) // for IE replace search string
            {
                search_requiredLabel = '<SPAN class=required>';
            }
            if (labelNode != null && labelNode.innerHTML.indexOf(search_requiredLabel) == -1) 
            {
                labelNode.innerHTML = labelNode.innerHTML.replace(requiredLabel, '');
                labelNode.innerHTML = labelNode.innerHTML + requiredLabel;
            }
        }
        else
        {
            if(labelNode != null)
            {
                if(labelNode != null && labelNode.innerHTML.indexOf("<SPAN class=required>*</SPAN>") == -1 && labelNode.innerHTML.indexOf('<span class="required">*</span>') == -1 )// for that field which is unrequired
                {
                }
                else if(labelNode != null && labelNode.innerHTML.indexOf(requiredLabel) == -1) // for IE replace span string
                {
                    requiredLabel = "<SPAN class=required>*</SPAN>";
                }
                labelNode.innerHTML = labelNode.innerHTML.replace(requiredLabel, '');
            }
        }
    }
}

谁能帮我解决这个问题...

Can anyone please help me out to solve this issue...

推荐答案

要从 Sugarcrm 中的 QuickCreate 中删除必填字段,您可以使用此功能:

To remove a required field from QuickCreate in Sugarcrm you can use this fuction:

removeFromValidate('EditView','eventlist_c');

或移除应用到该字段的验证:

or remove remove the validtion applied to the field:

$('#eventlist_c_label').html('{$mod_strings['LBL_EVENTLIST']}: ');

这篇关于从 Sugarcrm 中的 QuickCreate 中删除必填字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 17:13