There are two aspects in defining field type for your new database field. First, the script must know what type of database field to define, and secondly, must know what type of role this field has in data entry and display.
Database column types
- The short text field is the most straight-forward. These fields will hold text/numeric data which is less than 255 characters. This type of field provides the greatest flexiblilty in how it will be used. It can be entered in using the
text, dropdown, radio, checkbox, and image form object types. While theoretically, the textarea can be used, you will not be able to control the maximum length of the data that the user types in, other than specifying the length in the instructions, or adding custom javascript. Data that exceeds the length specified in setup will be truncated to the maximum length.
- Text Area Fields solve the problem stated above. These are text fields suitable for the text area and are unlimited in size. The textarea provides a scrollable text area to enter in large bits of text. The product description field, which is a standard field, is an example of this type of field. It can (and should) consist of HTML tags, carriage returns, tabs, etc. Please note that while carriage returns and tabs are valid characters, since they are displayed on HTML pages, they need HTML characters to format them.
Numeric fields are strictly for numeric data and will be checked for numeric only data. When in doubt, you can always store numeric data in short text fields as well as numeric data fields. The HTML objects that can be used for this type of field is the same as short text.
- Numeric with decimals. This format is suitable for currency, but without formatting characters or currency signs. With this format, you will be requred to enter the number of decimal places to store. Currency signs can be added on the templates.
- Integer types. This format is suitable for whole numbers only. Select the integer size that most closely matches the maximum size of your datafield.
- Date, time and datetime fields. When selecting date fields, please note that this database format must be YYYY-MM-DD. For other formats, it is recommended to use a short text field. Time formats must be hh:mm:ss
Form Object Types
This selection will be determined by how you want the data field to be displayed on the input screen. These correspond to the HTML input types.
- text. Choose this type if you want your user to enter in text or numeric values of limited and relatively short length.
- textarea. Choose this type if you want a scrolling text area for your user to enter in relatively long text passages.
- dropdown. (menu) This will display a list of choices to choose from. Use this if you have a standard set of values to be stored in this field.
- checkbox. Use this if you have a yes/no, on/off type of field.
- radio. This is an alternative to the dropdown or list.
- image (file). 5th Avenue does not faciliate the storage of image files in the actual database field. What is actually stored is the URL and file name of the image, so the database field type must be short text. When choosing the image object type, the file upload object will be used for input. In addition, for existing entries, the stored image URL is displayed in data input screens. Note: only the URL and file name is stored, it is the web-developer's responsibility to supply the appropriate image tags to display in on store templates.
|