简体   繁体   English

SuiteScript SCA-验证表单字段

[英]SuiteScript SCA - Validating a form field

I am attempting to validate a form field for an SCA (mont-blanc) site. 我正在尝试验证SCA(勃朗峰)网站的表单字段。 As I am not versed in SuiteScript code, but know Java, I simply need to know how to retrieve the POST value of a form field, so that I can do a check on the submission before submitting the form. 因为我不熟悉SuiteScript代码,但了解Java,所以我只需要知道如何检索表单字段的POST值,这样我就可以在提交表单之前检查提交内容。

The below is not working - simply because I don't know the function / method to call to get the email address that is being submitted. 以下内容不起作用-仅仅是因为我不知道调用函数/方法来获取正在提交的电子邮件地址。

name: 'ContactUs',
       create: function create( data ) {
            try {
                url = '<the-url>';
                var email = nlapiGetContext.getEmail();
                if (email.indexOf("qq.com") === -1) {
                    response = nlapiRequestURL(url, data);

                    responseCode = parseInt(respons...

To validate any field data you need to use client-script on the said record and based on your code and requirement, I think you want to validate Suitelet data(right?). 要验证任何字段数据,您需要在上述记录上并根据代码和要求使用客户端脚本,我想您想验证Suitelet数据(对吗?)。 You can deploy client script on any record/suitelet and validate field data in saveRecord method. 您可以在任何记录/套件上部署客户端脚本,并在saveRecord方法中验证字段数据。 You can find client script help doc here . 您可以在此处找到客户端脚本帮助文档。

Detecting the value in a data field in a submitted form is as simple as data['field_name'] 以提交的形式检测数据字段中的值就像data ['field_name']一样简单

In the above example - it would be: 在上面的示例中-将是:

name: 'ContactUs',
       create: function create( data ) {
            try {
                url = '<the-url>';
                **var email = data['email'];**
                if (email.indexOf("qq.com") === -1) {
                    response = nlapiRequestURL(url, data);

                    responseCode = parseInt(respons...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM