Navigation:  Sites & Actions > Forms - Recipient management > Forms > Example form: Amend a profile >

Creating a form to display data

Previous pageReturn to chapter overviewNext page

Preparations for the forms are now complete. Now go to the Forms section and select the New form sub-menu. Start by creating a form which will be used to display stored user profile data.

1.As a first step, assign your form a meaningful name. This name will be inserted in the link to call up the form, it should therefore contain no spaces and no umlauts or other special characters because they may cause problems at the recipient’s end depending on his or her web browser and email client. Using either upper or lower-case letters is not a problem, however, as long as you are consistent in their use. In our example, the Name is ShowProfile. In the Description box, you can give a description of the intended aim of the form.
2.In the Action drop-down list, select what OpenEMM should do before calling up the success form. All previously defined actions for that section are displayed in the drop-down list.
Please note: Only actions where you defined, under Usage, that they should be used Only for forms or Link and form are visible (see chapter "Defining actions" and "Creating a new action"). For our example, select the Load user data action you defined in the previous section as your action.
3.In the Success form box, enter text or HTML code for the website where user profile data should be displayed. A further example for displaying last name, first name, email address and mailing list status is explained below.
4.The Error form box takes the text the system should return in case of an error. Here, all HTML commands are available as before. For the purpose of our example, however, the text An error has occurred should be enough.
5.Our example does not need a concluding action. Just leave the No action entry in the Action drop-down list at the end of the entry dialog untouched. Click on Save to store your entries.
Fig. 8.5: This form will later display Last name, First name and Email address for your subscriber.

Fig. 8.5: This form will later display Last name, First name and Email address for your subscriber.

If you want your user to be able to change his or her profile data, these must be displayed as an HTML form. Otherwise, the text may not be changed within the browser, and it will not be possible to send the amendments to OpenEMM. The following example displays the contents of the FIRSTNAME, LASTNAME and EMAIL fields without any formatting. There is a button which, if clicked, transmits the amendments to OpenEMM.

The complete HTML code reads as follows:

<form action="form.do" method="post">
<input type="hidden" name="agnCI" value="88">
<input type="hidden" name="agnFN" value="SaveProfile">
<input type="hidden" name="agnUID" value="$agnUID">
<select name=”GENDER” size=”1”>
<option value=”2” #if( $customerData.GENDER == “2” ) selected #end >no specification</option>
<option value=”0” #if( $customerData.GENDER == “0” ) selected #end >Mr</option>
<option value=”1” #if( $customerData.GENDER == “1” ) selected #end >Mrs</option>
First name: <input type="text" value="$customerData.FIRSTNAME" name="FIRSTNAME"><br>
Last name: <input type="text" value="$customerData.LASTNAME" name="LASTNAME"><br>
E-mail address: <input type="text" value="$customerData.EMAIL" name="EMAIL"><br>
<input type="submit" value="submit!">
</form>

Please note: Date fields must be divided into three separate entry fields for entering the day, the month and the year. Field names are always: FIELDNAME_DAY_DATE, FIELDNAME_MONTH_DATE, FIELDNAME_YEAR_DATE.

Example for a date field birthday:

Day: <input type=”text” name=”birthday_DAY_DATE” /><br/>
Month: <input type=”text” name=”birthday_MONTH_DATE” /><br/>
Year: <input type=”text” name=”birthday_YEAR_DATE” />

This is an HTML form which is why tags are surrounded by <form>. The action attribute in the starting tag controls which script the form should evaluate when the Submit button is clicked. Always enter form.do here, and select method="post" as the transmission method.

The following three lines of code define hidden form fields. They do not actually appear in the web browser, but the data they contain will be transmitted when evaluating the form. OpenEMM needs them to be able to make changes in the right customer data record. These hidden fields have the following meaning:

<input type="hidden" name="agnCI" value="88">: The field entitled agnCI transmits OpenEMM your company ID. The value attribute sets the value, in this case 88. You will find your company ID on the forms overview site.
<input type="hidden" name="agnFN" value="saveProfile">: The agnFN field tells the system which form to call up after data have been transmitted by clicking on the Submit button. This subordinated form saves amendments made to the customer’s record in the profile database. In our example, the value is named saveProfile. This form will be created in our next example.
<input type="hidden" name="agnUID" value="$agnUID">: In order to identify a subscriber, OpenEMM creates a user ID for that user. This user ID was written into the $agnUID variable when the user profile was loaded. All you need to do is write the variable under value. Before issuing a web page, OpenEMM will automatically replace the variable with the correct user ID.

The next three lines from our example create entry fields from the customer profile data loaded in the previous step. It is up to you to decide which sections of a profile you want to display on the web page. The <input> tag structure is always the same. It is, of course, possible to include further HTML tags with the aim of formatting entry fields or data with right or left alignment or as a table. However, in order not to complicate matters further, we did not include them in our example. The line

<input type="text" value="$customerData.FIRSTNAME" name="FIRSTNAME">

defines an entry field for the subscriber’s first name. Two attributes are of importance here:

The value attribute contains a default value which the browser will enter into the relevant field when first calling up the form. This should, of course, be the current contents of the first name field which is saved in the profile database in that customer’s record. The script command $customerData accesses the whole profile which was loaded in the starting action (see chapter "Creating a new action"). The command ends with the name of the field from the profile database, separated from the command by a full stop. All profile fields including those you defined yourself are permissible. The name of the field must be written in upper-case letters. Chapter "Other profile data" contains a list of all field names. In our example, the name of the first-name field is FIRSTNAME.
To tell the OpenEMM what the field contains, i.e. what to use for evaluation, the name attribute gives the internal system field name, In our example, it is the FIRSTNAME field.

At the end of the HTML tags you define a button for the subscriber to click if he or she wants to send amendments to OpenEMM. In our case, we used the Submit button customary in HTML. The value attribute defines what the button says, in our example submit!

<input type="submit" value=“submit!">

Fig. 8.6: The form from our example called up in the browser. It looks a bit empty – it is, after all, only a demonstration example.

Fig. 8.6: The form from our example called up in the browser. It looks a bit empty – it is, after all, only a demonstration example.