Customizing Datatypes

Test Your Knowledge

TASK 1

  1. Create a data type called “Contacts”
  2. Add the following fields: First Name, Last Name, Age, Marital Status, Street, City, Phone, Email, Website.
  3. Add a few items.
  4. Localize the data type. Localize the data items where necessary.

TASK 2

  1. Apply a validation rule on the Age field that allows integers between 21 and 75.
  2. Apply a validation rule on the Email field to allow only well-formed email addresses.
  3. Apply a validation rule on the Website field to allow only well-formed URLs (starting with “http://” and including valid top-level domains such as “.com”)

TASK 3

  1. Create another data type called “Instant Messaging”.
  2. Add the field and name it “Application”.
  3. Add the following data items to the data type: ICQ, MSN, Skype, Yahoo, AIM.
  4. In the data type created in Task 1, add another field of the String type: IM.
  5. Reference the Instant Messaging data type as its field type.

TASK 4

  1. Edit the Contacts data type and select the IM field.
  2. Change its type from Data Reference to String.
  3. Replace the default TextBox widget with DataIdMultiSelector.
  4. Set the Data type to selectfrom property to the Instant Messaging data type.
  5. Save the data type, add an item and see what widget is used for the IM field.

TASK 5

  1. Edit the widget for the IM field again and set its Compact UI property to Compact.
  2. Save the data type, add an item and see what widget is used for the IM field now.

TASK 6

  1. Use the Forms Renderer add-on to create a web form based on the Contact data type.
  2. Create.NET resource files for the form for the main language and another language.
  3. Add strings to the resource files for form labels and help texts in a proper language.
  4. Use the resource string in the data type’s corresponding field properties.
  5. Open the page with the form and see if the form’s labels are in the main languages
  6. Switch to the localized version of the website and see if the form’s labels are in the other language.

TASK 7

  1. Edit the form markup of the Contacts data type.
  2. Place the First Name, Last Name fields in the Name field group and Age and Marital Status in the Personal Information field group.
  3. Place these 4 fields on the Person tab.
  4. Place the Street and City in the Address field group and Phone, Email, Website, IM in the Communication field group.
  5. Place these 6 fields on the ContactInformation tab.