ConfigurationNAV 4 Field Lengths

NAV 4 Field Lengths

Introduction

 
In this chapter you can find the list of all the Sana Commerce webshop input text fields which have a different length in Microsoft Dynamics NAV v4 and v5. 
 
A separate add-on for the Sana Commerce is available in order to provide support for NAV 4.  This add-on contains '*.ascx' control templates, which can be copy-pasted to the Sana Commerce source's folder.
To install these control templates find and navigate to the 'NAV4 add-on' folder and then locate 'Frontend' folder inside. It is needed to copy and paste the contents of this folder to Sana Commerce front-end directory (confirm to overwrite all existing files). After performing the described actions the control templates for NAV 4 support will be installed for Sana Commerce.
 
To be able to change the length of fields, you need to open the Sana Commerce SDK in MS Visual Studio 2008. If Visual Studio is not available, you can use any other text editor to change the 'Control' files. Each text field in a webshop is represented by the TextBox control.
 
In most cases, TextBox controls for each webpage are grouped in 'Control' files with an *.ascx extension. For example 'Address' and  'Address 2' text fields can be found in the GeneralCreateAccount.ascx control.
 
Page Name on Webshop Path to Control
Name of *.ascx File or *.aspx Page
Create New Account (B2C)
<website folder>/profile/controls
GeneralCreateAccount.ascx
Your Details (B2C)
<website folder>/profile/controls
GeneralEditProfile.ascx
Billing/Shipping (B2C): Billing fields
<website folder>/checkout/controls
GeneralBillingAddress.ascx
Billing/Shipping (B2C): Shipping Fields
<website folder>/checkout/controls
GeneralShippingAddress.ascx
Create Prospect
<website folder>/profile/controls
B2BContactControl.ascx
Billing/Shipping (Prospect)
<website folder>/profile/controls
B2BContactControl.ascx
 
The maximum number of characters that can be entered to in input field is regulated by the 'MaxLength' property of the TextBox control. For example: 
<asp:TextBox ID="name" runat="server" CssClass="tbx tbxProspectName" MaxLength="50">
</asp:TextBox>
Here we can see that the maximum length for the 'Prospect Name' field is set at 50 characters.
 
Please note that some TextBox controls have the 'Expression Validator' class which also has to be changed in order to change the maximum length of a text field. For example: 
<asp:TextBox runat="server" ID="ReferenceNumber" MaxLength="20" CSSclass="tbx tbxReferenceNumber" />
<asp:RegularExpressionValidator runat="server" ID="ReferenceNumberValidator" ControlToValidate="ReferenceNumber" ValidationExpression="^[\s\S]{0,20}$" EnableClientScript="false" CssClass="errormessage" Display="Dynamic" />
 
In order to change the maximum length of the 'Reference Number' field, you have to change not only the 'MaxLength' property (20 characters) but also the 'ValidationExpression' propery ({0,20}) for the 'Expression Validator' class. 
 
ConfigurationNAV 4 Field Lengths