How to create custom form in HTML for Suitlet in NETSUITE and get the form data

NetSuite default form is Ugly so You can create your own custom form in NETSUITE SUITELET and get the data of the form through request.getParameter. Here's How

/**
 * Module Description
 * 
 * Version    Date            Author           Remarks
 * 1.00       22 Feb 2016     Anurag
 *
 */

/**
 * @param {nlobjRequest} request Request object
 * @param {nlobjResponse} response Response object
 * @returns {Void} Any output is written via response object
 */
function RegisterPageUI(){
   var html=     
     '<form action="" method="post">'
     +'First name:<br>'
     +'<input type="text" name="firstname" value="Mickey"><br>'
     +'Last name:<br>'
     +'<input type="text" name="lastname" value="Mouse"><br><br>'
     +'<input type="submit" value="Submit">'
   +'</form>';
 return html;
}


function Register(request, response)
{
 if(request.getMethod() == 'GET'){
     
   var html = RegisterPageUI();  
   
      response.setContentType('HTMLDOC');
      response.write(html);  
      
     
     
    }else{
     var firstName = request.getParameter("firstname");
     var lastName= request.getParameter("lastname");
          
     response.setContentType('HTMLDOC');
      response.write(firstName + lastName + firstName + lastName+ firstName 
       + lastName+ firstName + lastName+ firstName + lastName);  
     
    }
    
}

Popular posts from this blog

What are sales territory in Netsuite?

How to get and set a sublist in netsuite suitlet suitescript 2.0