Capture Form Data for User Registration in NetSuite
Capture additional data in user registration forms by adding custom fields and validating input in NetSuite.
Capturing additional form data during user registration is vital for businesses that interact with other businesses. This guide elaborates on how you can enhance your registration process by adding custom fields to your forms and validating the information provided by users.
Steps to Capture Form Data
To successfully capture form data on the Login/Register page, you should follow these steps:
- Create custom fields in NetSuite - These fields hold the data entered by users on the Login/Register page.
- Set up your extension files or create a baseline extension - refer to the documentation for creating a baseline extension.
- Update the entry point file - This involves instantiating the
LoginRegisterPagecomponent and adding a child view. - Update the view file - Here, you define a view for the form and create a template that includes the input fields.
- Add input validation - Utilize the
beforeRegisterevent to validate input before the form is submitted.
Create a Custom Field
When users register, their details must be stored in NetSuite. To do this, custom fields are necessary. Here’s how to create a custom field:
- Navigate to Customization > Lists, Records, and Fields > Entity Fields > New.
- In the Label field, enter the desired name for the field.
- In the ID field, specify an identifier for the field. Note the use of an underscore at the start to aid readability (e.g.,
_comptaxnumbergenerates an ID ofcustentity_comptaxnumber). - On the Applies To tab, check Customer and Web Site.
- Click Save.
Update the Entry Point File
If you have a baseline extension, begin by creating an instance of the LoginRegisterPage component within the mountToApp() function. Each view added needs a specific placeholder ID:
1"text-purple-400">define(2 'Vendor.CompanyTaxNumber.MainModule',3 [Vendor.CompanyTaxNumber.MainModule.View],4 "text-purple-400">function(CompanyTaxNumberView) {5 'use strict';6 7 "text-purple-400">return {8 mountToApp: "text-purple-400">function mountToApp(container) {9 "text-purple-400">var loginRegisterPageComponent = container.getComponent('LoginRegisterPage');10 11 "text-purple-400">if (loginRegisterPageComponent) {12 loginRegisterPageComponent.addChildView('Register.CustomFields', "text-purple-400">function() {13 "text-purple-400">return "text-purple-400">new CompanyTaxNumberView(loginRegisterPageComponent);14 });15 }16 }17 }18 }19);Create a View
Define a view using the SCView class from the extensibility API. The view is responsible for user input through form elements. Here’s how this is structured:
1"text-purple-400">define(2 'NetSuite.CompanyTaxNumber.Main.View',3 [4 'SCView', 5 'jQuery',6 'netsuite_companytaxnumber_main.tpl'7 ],8 "text-purple-400">function(SCViewComponent, jQuery, netsuite_companytaxnumber_tpl) {9 'use strict';10 11 "text-purple-400">var SCView = SCViewComponent.SCView;12 13 "text-purple-400">function CompanyTaxNumberMainView(loginRegisterPageComponent) {14 SCView.call("text-purple-400">this);15 16 "text-purple-400">this.template = netsuite_companytaxnumber_tpl;17 18 loginRegisterPageComponent.on('beforeRegister', "text-purple-400">function(formFields) {19 "text-purple-400">if (formFields.custentity_comptaxnumber == '') {20 alert('You must enter your company tax number.');21 "text-purple-400">return jQuery.Deferred().reject();22 }23 });24 }25 26 CompanyTaxNumberMainView.prototype = Object.create(SCView.prototype);27 CompanyTaxNumberMainView.prototype.constructor = CompanyTaxNumberView;28 29 CompanyTaxNumberMainView.prototype.getContext = "text-purple-400">function() {30 "text-purple-400">return {};31 }32 33 "text-purple-400">return CompanyTaxNumberMainView;34 }35);The getContext function provides data needed for the view. Don’t forget to update your HTML template to include the custom field, ensuring the name attribute matches the field ID:
1<p class="login-register-register-form-description">2 We only serve business customers who are currently registered for tax in Canada, USA, and France.3</p>4<div class="login-register-register-form-controls-group" data-validation="control-group">5 <label class="login-register-register-form-label" for="company-tax-number"> Company Tax Number <small class="login-register-register-form-required">*</small></label>6 <div class="login-register-register-form-controls" data-validation="control">7 <input type="text" name="custentity_comptaxnumber" id="company-tax-number" class="login-register-register-form-input">8 </div>9</div>This example ensures that your registration form accurately captures and validates additional data efficiently, enhancing the user experience while also fulfilling necessary business requirements.
Frequently Asked Questions (4)
What permissions are required to create and apply custom fields for user registration in NetSuite?
How do custom fields created in NetSuite apply to the Login/Register page?
Is input validation possible for the custom fields during user registration?
How does the custom field data get integrated into the HTML template for the registration page?
Was this article helpful?
More in Commerce
- Available Items Only Feature in NetSuite 2026.1
Available items only filtering boosts sales efficiency in NetSuite 2026.1 with Intelligent Item Recommendations.
- Commerce Extensions in NetSuite 2026.1
Commerce Extensions in NetSuite 2026.1 enhance performance and user experience in eCommerce.
- Convert Multiple Transaction Line Items into Configured Items in
Enhance transaction processing in NetSuite by converting multiple line items into configured items with improved session handling.
- New SuiteCommerce Features in NetSuite 2026.1
New SuiteCommerce features in NetSuite 2026.1 enhance user experience and improve eCommerce efficiency.
