Navigation:  Sites & Actions > Forms - Recipient management > Forms > Example form: Opt-in >

Creating a form to enter data

Previous pageReturn to chapter overviewNext page

The form for data entry looks quite similar to the form for entering data to change a customer record which we explained in the previous chapter. There are, however, a few differences:

Data on gender (i.e. greeting or title) as well as the mailing type and the email address are mandatory, and a subscription for a mailing list is also required. Otherwise OpenEMM will not accept the new subscription data.
The user has not been created yet, which is why the HTML code for the success form does not feature the hidden field with the user ID (agnUID). This user ID will be created automatically by the system as soon as the new subscriber’s record is saved in the database.

Create a new form using the navigation bar as usual. This form will only collect all data entered by a potential new subscriber in various fields. It will then pass on the data to the script on the OpenEMM server for processing. No actions are involved here.

1.Select a meaningful Name in the entry dialog, e.g. Subscribe. This name will become part of the link for calling up that form later. It should therefore contain neither spaces nor any special characters. The Description should briefly describe what the form will do.
2.The Success form entry box will take HTML code to call up and display a form with the required entry fields in the web browser. The next section explains the required code structure in detail.
3.The Error form entry box takes text which potential subscribers will see if their registration is not successful. Saving the form using the Save button concludes entry of the form.
Fig. 8.10: The registration form consists mainly of HTML code to display the corresponding web form.

Fig. 8.10: The registration form consists mainly of HTML code to display the corresponding web form.

HTML code for the subscription form looks quite similar to the one for changing a customer record. There are, however, a few differences. There is no user ID, for instance. Other entries are required instead, though. The following example assumes that the subscriber registers to receive a newsletter which is always sent out impersonally (no customized greeting or title) in HTML format. You may also let the potential subscriber make the required entries. For this see chapter "Advanced form layout".

The complete HTML code for our example reads as follows:

<form action="form.do" method="post">
<input type="hidden" name="agnCI" value="XX">
<input type="hidden" name="agnFN" value="subscribeConfirm">
<input type="hidden" name="agnMAILINGLIST" value="3">
<select name=”GENDER” size=”1”>
 <option value=”2” selected>no specification</option>
 <option value=”0”>Mr</option>
 <option value=”1”>Mrs</option>
First name: <input type="text" value=" " name="FIRSTNAME"><br>
Last name: <input type="text" value="" name="LASTNAME"><br>
Email address: <input type="text" value="" name="EMAIL"><br>
<input type="submit" value="submit!">
Format:
<select name="MAILTYPE" size="1">
 <option value="2">Offline-HTML
 <option value="1" checked>HTML
 <option value="0">Text
</select><br>
Subscribe for newsletter: <input type="checkbox" name="agnSUBSCRIBE" value="1">Yes<br>
<input type="hidden" name="agnMAILINGLIST" value="XX">
<input type="submit" value="Subscribe">
</form>

The first three lines of code are the same as in the form to display saved customer data. They define the script which, on the OpenEMM server, will evaluate customer data, create a customer ID (agnCI is always 1 in OpenEMM) and define the form which will then be called up (in our example: SaveProfile). Chapter "Creating a form to display data" contains a detailed explanation of all options. From line 4, the HTML code creates entry fields for the subscriber’s customer data.

<select name=“GENDER”> ... </select>: This selection operates the field GENDER in the database and allows the user to set how he or she will be addressed. In OpenEMM, 0 means male, 1 means female and 2 means a gender-neutral form of address.
Please note: <input type=“hidden” value=“2” name=“GENDER”><br>: The hidden entry field determines the gender of the recipient. With type=“hidden” you transmit the gender without the user being able to make a selection. This can be used for registrations where only the email address is recorded. In the example, this is why a 2 (unknown) is entered in the attribute value.
<select name=“MAILTYPE”> …. </select>: The MAILTYPE selection determines in which format the recipient receives the emails. A 0 stands for text, a 1 for HTML, a 2 for Offline-HTML.
Please note: <input type=“hidden” value=“1” name=“MAILTYPE”><br>: In this variant, a 1 for HTML format is permanently set. The selection cannot be influenced by the user.
The entry fields for first name (FIRSTNAME), last name (LASTNAME) and email address (EMAIL) will be empty in the form (attribute value=""). The potential subscriber must enter his or her personal data here.
Subscription to the mailing list in question requires two form elements, the reason being that each form element can only save one value in HTML. The first element is a check box. It determines whether or not subscription to the mailing list is activated. The second element is a hidden field containing the mailing list’s internal code ID. It is very easy to determine this mailing list ID: Call up the detailed view for the list and look for the mailinglistID= text in your browser’s address bar. In our example it is 526.
OpenEMM will automatically make the connection between the two elements. If you would like to enter more than one mailing list subscription, you will need two form elements for each. Just number them consecutively, for instance agnSUBSCRIBE2 and agnMAILINGLIST2 etc.
The last line but one creates the usual Submit button for sending off the form. The last line concludes form definition in HTML.

There are various options for slightly more attractive formatting in HTML, for instance using a table layout. In our example, we have only included a few carriage returns (<br>) to separate the more important elements clearly.

Fig. 8.11: A simple form for registering a new subscriber. In practice, there are limitless formatting possibilities for you to adapt the layout to your website graphics.

Fig. 8.11: A simple form for registering a new subscriber. In practice, there are limitless formatting possibilities for you to adapt the layout to your website graphics.