Create Signup with name and email

Occasional Participant

Create Signup with name and email

I have inherited maintenance of a website that has a signup form that uses another service other than CC. However, I have used CC for years with other sites and would prefer to move this new site over to CC. However, I have gotten stuck with the conversion of this signup box. I would prefer to keep the look of the box as is, but CC built-in boxes only seems to be capable of capturing email address alone, and not email and name. Thus, I'm assuming that I need to come up with the code to implement this on my own (or hopefully from some kind soul on this forum). I've been browsing about but have not found what I need.


Here is the current code used:


 



<form method="post" action="http://tools.yourwebpilot.com/EmailBlast/form.php?form=15" id="frmSS15" onSubmit="return CheckForm15(this);">
<input type="hidden" name="format" value="h">

<script language="javascript">
function CheckMultiple15(frm, name) {
for (var i=0; i < frm.length; i++)
{
fldObj = frm.elements;
fldId = fldObj.id;
if (fldId) {
var fieldnamecheck=fldObj.id.indexOf(name);
if (fieldnamecheck != -1) {
if (fldObj.checked) {
return true;
}
}
}
}
return false;
}
function CheckForm15(f) {
if (f.email.value == "") {
alert("Please enter your email address.");
f.email.focus();
return false;
}
return true;
};
</script>



<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td class="white" width="99%">Name</td>
<td width="1%" align="center"><input type="text" name="CustomFields" id="CustomFields_65_15" value="" size='25' maxlength='50' class="inp"></td>
</tr>
<tr>
<td class="white">Email</td>
<td align="center"><input type="text" name="email" class="inp" value=""></td>


</tr>
<tr>
<td>&nbsp;</td>
<td align="center"><input name="" type="image" src="images/btn_submit.gif"></td>
</tr>
</table></form>
5 REPLIES 5
Employee

It appears that you are attempting to POST the name and email contained in the form to the following URL: http://tools.yourwebpilot.com/EmailBlast/form.php?form=15

 

Unfortunately, this is not going to function for our sign up form through our API. You would need to create a form that uses the POST method to pass an XML that contains a minimum of the following elements. Please note this is only an example:

 



<entryxmlns="http://www.w3.org/2005/Atom">


 <titletype="text"> </title>

 <updated>2008-07-23T14:21:06.407Z</updated>

 <author></author>

 <id>data:,none</id>

 <summarytype="text">Contact</summary>

 <contenttype="application/vnd.ctct+xml">

    <Contactxmlns="http://ws.constantcontact.com/ns/1.0/">

      <EmailAddress>test_100@example.com</EmailAddress>

      <OptInSource>ACTION_BY_CONTACT</OptInSource>

      <ContactLists>

        <ContactListid="http://api.constantcontact.com/ws/customers/geeksquad/joesflowers/lists/1"/>

      </ContactLists>

    </Contact>

 </content>

</entry>


For more information on this process please take a look at Creating a Contact


 

 

I would also recommend taking a look at our C# and PHP example sign up forms,  as well as our full API Reference Guide

David J

Occasional Participant

Dave,


 


I appreciate the starting help. I also realize I am treading in an area likely beyond my knowledge base, but feel compelled to give it a go. The concept seems fairly simple - I have a web page that has a signup form that will send the information I want/need to capture - name and email address. I of course realize that the current information directing the collection of data to a party other than CC needs to be altered. And having used CC for years, I would prefer to continue using CC. So I am faced with three options - alter the web page and use a CC template to collect just the email since they don't seem to have a built-in signup form to collect name data as well - this option is my last resort. Option 2 - just alter the page to have the data sent via email and then manually update our CC account with the info - a possibility but not exactly what I am after, and of course, option 3 - to create a form using CC API to do what the page currently does with our current provider. This is where I would want to go, but after looking at the various materials you referenced I'm more than a little confused.


 


If I read it right, I need to create two forms - one to transmit (POST) the data from an XML form, and an XML form itself. Are these separate forms, or is this code which will incorporate into my existing HTML page and replace the current code that the current provider utilized?


 


Any additional guidance you (or others) could provide would be very helpful. This is the final step keeping me from using CC with this account, and I would love to find a way to solve it.

Moderator

The first option you are talking about is not entirely true.  We do offer a Join My Mailing List form that will allow you to put a sign up box or sign up button on your website.  When the user clicks the button or enters their email address, it will bring them to a form to collect more information.  This form is hosted by Constant Contact and can be edited in your account in the Contacts -> Join My Mailing List section.  


 


The reason some companies and organizations use our API instead is that the form will open up in another window on a Constant Contact website.  If you would like the form to open up in your website with your branding, you will need to use the API. 


 


Regarding using the API, there are two steps to doing this.  The first is creating the HTML form for submitting the data to a server side script.  The second is creating a server side script to take that HTML form data and submit it via the API as a REST request (which as you pointed out uses XML).  If all you are looking to do is create a sign up form, we have samples that will already take care of 95% or more of the server side portion and give you a starting point on the HTML form.  You can find these samples in PHP and C# ASP.NET here.  These samples will allow you to set up an API sign up form with almost no programming work needed.

Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant

Dave,


I'm almost where I need to be with this. I have no problem using a separate window or the CC site for my form. I do however want to utilize the sign up box that exists on my current site, so what I have done is taken the code from the HTML wizard and used only that which pertains to the posting of the email address from the sign up box. I have tested it out, and have just one problem. When I click on submit on my site, even though I am using an already registered email address, it does not tell me that the address is in the database until I enter the address again - but I do not have it set to require reentry of the address. When I test the same code out using the entire code from the HTML wizard it takes me to a different page which does recognize an existing address and asks if I want to update my profile/interests. Any insight on this final aspect?


 

Moderator

I would need to see your code for that page to tell you exactly what went wrong, however it is likely that your form submit is using the wrong hidden inputs or input names and we are not receiving the email address.  If you want to send me your changed code, you can get it to our webservices support team by emailing us.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page