部署的SCA版本不会发生输入验证

时间:2017-03-24 05:22:35

标签: netsuite suitescript suitecommerce

我有一个非常奇怪的错误,我的注册表单在部署时未验证新的输入字段(性别,出生日期)。但完全相同的代码在我当地的SCA Mont Blanc上验证。

我已经完成了部署,即gulp deploy

我已覆盖Account模块。我的Account/Javascript/Account.Register.Model.js文件添加了以下验证:

//@property {Object} validation. Backbone.Validation attribute used for validating the form before submit.
validation: {
    firstname: { required: true, msg: _('First Name is required').translate() }
,   lastname: { required: true, msg: _('Last Name is required').translate() }
,   email: { required: true, pattern: 'email', msg: _('Valid Email is required').translate() }
,   company:  { required: SC.ENVIRONMENT.siteSettings.registration.companyfieldmandatory === 'T', msg: _('Company Name is required').translate() }
,   password:  { required: true, msg: _('Please enter a valid password').translate() }
,   password2: [
        { required: true, msg: _('Confirm password is required').translate() }
    ,   { equalTo: 'password', msg: _('New Password and Confirm Password do not match').translate() }
    ]
,   gender: { required: true, msg: _('Gender is required').translate() }
,   dobday: { required: true, msg: _('Date of birth is required').translate() }
,   dobmonth: { required: true, msg: _('Date of birth is required').translate() }
,   dobyear: { required: true, msg: _('Date of birth is required').translate() }
,   phone: { required: false, pattern: 'digits', msg: _('Phone or Mobile number is required').translate() }
}

我已将输入添加到LoginRegisterOverrides@1.0.0/Templates/login_register_register.tpl。我不会展示所有这些,但这里是性别输入:

<div class="login-register-register-form-controls-group" data-validation="control-group">
    <label class="login-register-register-form-label" for="register-gender">
        {{translate 'Gender <small class="login-register-register-form-required">*</small>'}}
    </label>
    <div class="login-register-register-form-controls" data-validation="control">

        <select name="gender" id="register-gender" class="login-register-register-select" data-action="selectgender" data-toggle="select-gender">
            <option value="">
                {{translate '-- Select --'}}
            </option>
            <option value="1">
                Male
            </option>
            <option value="2">
                Female
            </option>
        </select>
    </div>
</div>

我已确认我的模块ns.package.json文件正在覆盖正确的文件。此外,它在本地(gulp local)工作,所以我知道它们设置正确。

为什么输入在部署时不会验证但是它们在本地执行会出现什么问题?

以下是我当地的SCA网站(性别和DOB输入验证正确)。 enter image description here

以下是我部署/在线的SCA网站: enter image description here

1 个答案:

答案 0 :(得分:0)

经过几十个小时试图解决这个问题之后,事实证明错误是我的JavaScript模块文件夹中的's'的情况。

ns.package.json我有:

{
    "gulp": {
        "javascript": [
            "JavaScript/*"
        ],
    },
    "overrides": {
        // Problem here Should be /JavaScript/ not /Javascript/
        "suitecommerce/LoginRegister@2.1.0/Javascript/LoginRegister.Register.View.js": "Javascript/LoginRegister.Register.View.js",
    }
}
哇,我在Windows上,所以文件路径在本地有效但NS服务器必须是Linux。如果是的话,为什么SCA开发人员不会为了基督而将所有文件夹都用下划线小写!