how to create a subscribe form in OpenEMM

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

sturmey
Posts: 13
Joined: Wed Apr 16, 2008 3:33 pm

how to create a subscribe form in OpenEMM

Post by sturmey »

OpenEMM does not have the forms you require to have users subscribe to your list automatically. You will have to create one.

Start by going to the forms section.
Click on new form
Enter a name for the form. I used "Subscribe". do not use spaces as they will cause problems when calling the form at the address bar in your web browser
Enter a description. optional
Leave action on No action
Enter code into success-form.code follows
Enter error message into error-form.something nice like "oops!"
Leave action on No action
Click on Save

You've created a form
To access this form enter http://xxxxxxxxx:8080/form.do?agnCI=1&agnFN=FormName into your web browser where xxxxxxxxx is the domain name or ip address of the server hosting OpenEMM and FormName is the name you called your form.

You can see how the form name you chose is used directly in the URL which makes using space a problem. Also remember that in OpenEMM agnCI=1 is always used because the open source version doesn't support multiple companies but the tag is still required.

Code: Select all

<form action="form.do" method=post>
<!-- static inputs required, but not used -->
<input type="hidden" name="agnCI" value="1">
<input type="hidden" name="agnFN" value="SaveProfile">
<input type="hidden" name="MAILTYPE" value="1">
<input type="hidden" name="GENDER" value="2">
<input type="hidden" name="agnFN" value="SaveProfile">
<!-- user inputs -->
<br>
Firstname: <input type="text" name="FIRSTNAME" value=""><br>
Lastname: <input type="text" name="LASTNAME" value=""><br>
E-mail: <input type="text" name="EMAIL" value=""><br>
<!-- list of mailings -->
<br>
Check this box to subscribe to our course mailings <input type="checkbox" name="agnSUBSCRIBE"
value="1"><br>
<input type="hidden" name="agnMAILINGLIST" value="1">
Check this box to subscribe to our Newsletter <input type="checkbox" name="agnSUBSCRIBE2"
value="1"><br>
<input type="hidden" name="agnMAILINGLIST2" value="2">

<input type="submit" value="Submit">

</form>
In this example, I have asked for 3 things from people signing up. First name, Last name, and email. I have also given 2 choices for mailing lists. because OpenEMM requires all data fields to be filled, I have included the additional data as "hidden" with the data values set to a default value.

So in order:
<input type="hidden" name="agnCI" value="1">
type="hidden" means it won't be shown on screen, but can be seen by end user if they choose view source.
name=agnCI is the db variable that you are trying to modify or update.
value="1" is the information you will put into the variable.
agnCI is the company code that is required on all transactions in OpenEMM
agnFN is the form that is called when the submit button is pressed. info in following post
MAILTYPE is the selection text, html or offlineHTML. everyone gets html o=text, 1=HTML, 2=offlineHTML
LASTNAME is the last name.
FIRSTNAME is the first name.
EMAIL is the email address. these should be self explanatory

The next section is more complicated as we are putting check boxes for the mailing lists that people will subscribe to.
name=agnMAILINGLIST is the variable for the mailing list that you've created, value="1" sets the value of the variable to that of the mailing list. you can see what this value should be by clicking on mailing lists in the program and it will be listed on the left side under the heading ID.
note that this is hidden, but is triggered by the checkbox with the name agnSUBSCRIBE. These variables are somehow tied together. No real explanation for this, but they are.

This is important, agnMAILINGLIST, and agnSUBSCRIBE must have a number after them that correspondes to the ID and the value. What this means is when you create another form for a separate mailing list, you have to label the variables and value to match. When we created a third mailing list with its own sign up form, we had to label the variables agnMAILINGLIST3 and agnSUBSCRIBE3 and set value="3" in the form.

At the end of the form is the submit button. the value="xxxxxxx" is where you change the label listed on the button. I have left it the same as the "example" code in the manual.
<next is the forms that this one calls>
Last edited by sturmey on Wed Apr 30, 2008 8:13 pm, edited 1 time in total.
sturmey
Posts: 13
Joined: Wed Apr 16, 2008 3:33 pm

supporting forms for subscriber sign up

Post by sturmey »

In the previous form, there was a call to:

Code: Select all

<input type="hidden" name="agnFN" value="SaveProfile">
This calls the Save Profile form, but you have to create it and the "action" that it calls.

Let's start with the action.
Click on Actions
Click on New action
Enter a name. The manual used "Save User" we will do the same.
Enter a description. I used "save user"
Choose the usage, in this case we will choose only for forms
Where it says "Add step:" choose Subscribe and click on add.
There are two options, "use double-opt-in" and "Check for duplicate records"
getting this to work is hard enough without the double opt in, if you can figure it out, post an answer here. I did choose "Check for duplicate records", and chose email as the record to verify. This ensures that no one gets duplicate emails.
Click on Save

Now that we have the action, we can create the form that ties everything together.
Click on Forms
Click on New form
For name put in "SaveProfile" This is the same as in the manual. you could use that example, but it's rather difficult to follow.
For Description: enter something useful, like "save profile"
For Action: choose "Save user" This is why we created it first. We need to have it here in the drop down list.
In the Success-form box enter the HTML like code that you want people to se when the form was successfully submitted. I put in, this was saved successfully
In the Error-form: box put an error message.
The last action drop down list should be left at No action
Click on Save

Now that you've completed this form, you can test the functionality by going to a new browser window and entering the web address of the initial form. Since I used Subscribe for the form I created in the previous post, the URL for my form looks like:
http://xxxxxxxxx:8080/form.do?agnCI=1&agnFN=Subscribe
replacing xxxxxxxxx with the IP address or domain name corresponding to your installation.
after entering some test information and clicking on submit you should see a new listing in you recipient list.

Please realize that I was able to get this to work following these steps exactly. I don't know what half of this does, and really can't answer questions outside of this. I do know that these steps produced a working form. I will try to add more information as I discover it.

Sturmey
Post Reply