Form to add contacts stopped working

SOLVED
Highlighted
Member

Form to add contacts stopped working

Hello,

 

We've been using a form to add contacts from our site for a little less than a year. Recently it stopped working and presents some users with a blank white screen.

 

The form only attempts to add a contact if their email address isn't already in our list of contacts. We've been able to isolate the problem to when the form is adding a contact. If we already have the email address everything still works. I've included the php.

Any reason why this would suddenly go on the fritz?

 

Thanks for your time.

 

 

 

if (empty($response->results)) {

   $action = "Creating Contact";

   $contact = new Contact();

   $contact->addEmail($_POST['regform-email']);

   $contact->addList('9');

   $contact->first_name = $_POST['regform-first-name'];

   $contact->last_name = $_POST['regform-last-name'];

 

   if (isset($_POST['regform-phone']) && strlen($_POST['regform-phone']) > 1){

      $contact->home_phone = $_POST['regform-phone'];

   }

 

   $address = new Address();

   $address->address_type = "UNKNOWN";

 

   if (isset($_POST['regform-address']) && strlen($_POST['regform-address']) > 1){

      $address->line1 = $_POST['regform-address'];

   }

 

   if (isset($_POST['regform-city']) && strlen($_POST['regform-city']) > 1){

      $address->city = $_POST['regform-city'];

   }

 

   if (isset($_POST['regform-state']) && strlen($_POST['regform-state']) > 1){

      $address->state_code = $_POST['regform-state'];

   }

 

   if (isset($_POST['regform-zip']) && strlen($_POST['regform-zip']) > 1){

      $address->postal_code = $_POST['regform-zip'];

   }

 

   $contact->addAddress($address);

   $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, false);

}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
CTCT Employee

Re: Form to add contacts stopped working

Hi Donald,

 

This should be a pretty straightforward fix. If you change the address_type from UNKNOWN to either BUSINESS OR PERSONAL, your form should start working again.

 

Sorry for the trouble here. We noticed that even though we documented that only personal or business address types should be used, and were required when a phyical address was being added, some addresses were going into the unknown category, and were then unable to be retrieved through the API. Sorry the change negatively impacted you.

 

Best Regards,

Shannon Wallace

Partner API Support Engineer

View solution in original post

3 REPLIES 3
Highlighted
CTCT Employee

Re: Form to add contacts stopped working

Hi Donald,

 

This should be a pretty straightforward fix. If you change the address_type from UNKNOWN to either BUSINESS OR PERSONAL, your form should start working again.

 

Sorry for the trouble here. We noticed that even though we documented that only personal or business address types should be used, and were required when a phyical address was being added, some addresses were going into the unknown category, and were then unable to be retrieved through the API. Sorry the change negatively impacted you.

 

Best Regards,

Shannon Wallace

Partner API Support Engineer

View solution in original post

Highlighted
Developer

Re: Form to add contacts stopped working

Gah, you need to announce changes to required fields! 

CTCT Employee

Re: Form to add contacts stopped working

Hi,

 

I totally understand the frustration here. If it helps at all, we had always said in our documentation that the address_type was required and only able to be set to personal or business. It's just that we weren't enforcing that until very recently. Sorry again for the trouble this caused.

 

Best Regards,

Shannon Wallace

Partner API Support Engineer

Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured