Custom Fields - Extended Demo Case

Froonze

Last Update منذ عامين


Let's say that we want to create a form for a travel agency with a number of custom fields to collect different specific customer data:

  1. Which of the places the customer visited he/she enjoyed the most
  2. How would the customer describe his/her last travel experience
  3. How many times a year the customer travels
  4. What would be an approximate date of his/her next travel
  5. How many members of the family will travel
  6. How important is cost when choosing the vacation destination (from a predefined set of 3 possibilities)
  7. Which countries in SouthEast Asia the customer would like to visit (from a predefined set of 5 countries)
  8. If the customer accepts to share this information with other tour operators
  9. Birthday

The questions are kind of paradigmatic of the type of metafield contents and custom fields we can use. Let's do the reasoning in our 2 steps, first of which is creating the custom fields (along with the metafield definitions).

  • Question 1 will require a short text answer, so we will create a single_line_text_field type field for it and label it Best place ever visited
  • Question 2 will a probably long text answer, so it fits into a multi_line_text_field type field, let's label it Travel Experience
  • For question 3 we want the customer to return a round number. Let's create a number_integer type field and label it Travels per year
  • On Question 4 we want to collect a date, so we will create a date type field, labelled Next travel date
  • Question 5 will require again to collect a round number, so we create a new number_integer type field and label it Family members
  • For Question 6 we could choose to output the whole text ("very important", "moderately important, "not important") or a value in numbers to represent a degree of importance ("1","2","3"). Let's choose the whole text and create another single_line_text_field type field labelled Cost concern
  • On Question 7, same as question 6, we could choose to output either the whole text (name of country) or a number, but we are choosing the text. But unlike question 6, Question 7 will be collecting different answers or values to the same question, since we are giving the customer the option to select different countries from our set of five. In this case we will need to create a multi_choice type field, and since the output is going to be a text, only for this field type we will also need to set up an extra data type: single_line_text_field. Will label it SEA countries to visit
  • In Question 8 we want to collect a yes/no answer to a specific question or proposal, so let's choose a boolean type field for it and label it Sharing Agreement
  • Question 9, to collect either Gender or Birthday the custom fields are built in the app already so we don't need to create any new one

Here are all 8 fields we created:


Now let's have these fields added and configured in the form. There's some last reasoning to do regarding the options we want to give to the customer to input the data:

  • Question 1: we add our new Best place ever visited custom field with the Add Field modal. We don't want the input values to be predefined so customer can input this value manually, we will select a Single Line Text input type instead of the other input types the field can use (Radio or Dropdown) and that would require the customer to choose one of a predefined set of values. We'll also label the field with the title we want to show in the form: Which of the places you visited you enjoyed the most?
  • Question 2: we add Travel Experience custom field, which as a multi_line_text type already has an only and default input type, a Textarea where the customer can input manually a short or longer text. We label the field: How would you describe your last travel experience?
  • Question 3: we add Travels per year custom field. Let's say that in this case we want the customer to choose any number even if we know a very high number is unlikely as result. We then select an Integer Number input type as we want the customer to be free to input manually any integer number, instead of using the other input types the field can use (Radio or Dropdown) and that would require to set different options so the customer can choose one. We label the field: Times a year you travel
  • Question 4: we add our Next travel date custom field, which as a date type field already has an only and default input type, a Date picker that is precisely what we need so the customer can choose a date. We label the field: When do you plan to travel again?
  • Question 5: we add our Family members custom field. We again need the customer to input a number, but in this case we could assume members of family are not going to be that many, so we are going to select a Dropdown input type with predefined options 1 to 12 so the customer can just pick one of these predefined values. We label the field: How many members of your family will travel with you?
  • Question 6: we add Cost concern custom field. In this case we want the customer to choose one of a predefined set of values, and we would also like the three values to be visible on the screen. Instead of the other input types the single_line_text field type admits (single-line and dropdown) let's select a Radio input type this time and predefine the options: Very important, Moderately Important, Not at all important. We label the field: How important is cost when choosing your vacation destination?
  • Question 7: we add our SEA countries to visit custom field. We know the customer must be able to select different options from a predefined set of values and we've already set up the field in the step before as a multi_choice single_line_text type, which already has an only and default input type, the one we need (multi-choice), so the customer is able to select different options and the values are collected as texts. We just need to predefine the options: Cambodia, Indonesia, Laos, Thailand, Vietnam. We label the field: Which countries in SouthEast Asia you would like to visit?
  • Question 8: we add our Sharing Agreement custom field. The customer needs to agree or disagree to share personal information. It's a yes or no value and the boolean type custom field we created already has an only and default input type to collect this: a checkbox. We label the field: Do you agree to share this information with tour operators?
  • Question 9: we add a Birthday custom field, which is already built-in as a Date picker. We won't relabel this and will move it a bit up the form side by side the email field

The result on site