Upcoming Maintenance on November 11, 2024: Please note that our service will be temporarily interrupted for some maintenance on Monday, November 11th, 2024, from 10PM to 11:30PM (EST). During this period, the application will be inaccessible and some statistics may not be compiled. Also, some functionalities may be interrupted and any scheduled emails will be sent once the service is restored. We're sorry for any inconvenience this may cause you.
Close

Code example: create a drop-down list

Some fields can be displayed in different ways. For example, you could use a custom field to record how often your subscribers wish to receive communications. By presenting this question as a drop-down list, you will be able to get easy-to-sort, uniform answers.

How to:

  1. Use the form code generated by our tool. You will only change the part you want. How to generate the code.
  2. Note the name attribute of the field you want to display as a list. This is very important for the information to be saved correctly! In the code snippet below, it is shown in yellow. Usually the ID attribute has the same value.
  3. Each option tag represents a possible answer. You can put as many as you want, but it is generally recommended to limit the choices to about ten values. 
    • The value attribute is the information that will be saved in your contact. You can enter whatever you want, but it is best to keep this value simple, short, and without special characters if possible. In the example below, it is shown in pink.
    • Between the opening and closing parts of the option tag is the text visible to your subscribers. In the example below, it is shown in green.
  4. Once you're finished, test your code by signing up and selecting an option. Make sure that the information is correct in your contact.

Sample code :

<form accept-charset="utf-8" action="https://app.cyberimpact.com/optin" method="post">
  <label for="ci_custom_field_1">How often do you prefer to receive our communications?</label>
  <select name="ci_custom_field__1" name="ci_custom_field__1">
    <option>Please select</option>
    <option value="weekly">Once per week</option>
    <option value="biweekly">Every 2 weeks</option>
    <option value="monthly">Once a month</option>
  </select>
</form>

Top