0
votes

I am attempting to validate a form field for an SCA (mont-blanc) site. 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.

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...
2

2 Answers

1
votes

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?). You can deploy client script on any record/suitelet and validate field data in saveRecord method. You can find client script help doc here.

0
votes

Detecting the value in a data field in a submitted form is as simple as 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...