Archive for July, 2012

7 Reasons to Love Formidable Pro

Our team has been using Formidable Pro since we bought a license a month ago. Formidable has taken the load off us as far as user input goes on WordPress websites. We’re using it for anything from basic contact forms to collecting user data. Using formidable is a three-step process:

  1. Create Forms
  2. Manage Submissions
  3. Display Content
We mainly use formidable to create, collect and send information on contact forms.  Here’s why we love it:
  1. Visually create forms – Drag and drop interface allows quick form management and clean
  2. Create form templates – Form templates eliminate duplicate work.  Create form templates and export to other formidable installations.
  3. Store all data for later review – Store form submission information for later access.  Database entries are automatically created.
  4. Send form data by email – Easily send information or notification by email.  Uses WordPress’s email configuration to send nicely formatted emails.
  5. Easily create reports – Report to your heart’s content on data that formidable has collected.  Use default reports or create your own.
  6. Create custom form displays – Custom form displays allow the same form tobe displayed differently in different locations.
  7. Complete creative form control –
At $97 you can’t go wrong.  Buy formidable today.

How Can I make a Dynamic Grid Layout Like Pinterest?

Pinterest may have changed how people go about webdesign that draw people via images. Before Pinterest, columns usually floated left or right and were subjected to starting where the last one left off, there wasn’t much desire for dynamic grid layouts. After Pinterest showed the world how cool a site could look with them, it became a desired feature for many websites soon after.  There is a pretty easy solution for it too:


Get the plugin at: http://masonry.desandro.com/

This plugin that will help you get that Pinterest styled look.  It’s also still useful if you are not sure on the height of the element items (from either just not knowing, or because the content inside the element varies dynamically).  It will calculate the absolute position needed per item for you, just call the masonry function after they load.

The basic structure of the elements is as follows:

<div id="container">
<div class="box">content</div>
<div class="box">content</div>
<div class="box">content</div>
</div>

The only extra code that activate the plugin is:

$('#container').masonry({
  itemSelector: '.box'
});

In any case, this was really useful and a pioneering plugin in modern web development.
Happy Coding ^_^

A few things to overcome with Authorize.net ARB

Setting up an Authorize.net Automatic Recurring Billing (ARB) subscription-based payment system is generally easy to implement. Authorize gives you great libraries to get you started and they are very easy to understand. I used the PHP library and I didn’t have any problems setting this up. I did, however, run into a few issues that anyone new to Authorize.net should consider.

The first thing thing I ran into was that our client had their account in Test Mode. I couldn’t get our clients credentials to work though. The api would respond with an authentication error. I then created a test developer account, which is recommended. I was able to use my new api key and get the calls to work. So what’s up with our clients keys that won’t work? Well after a good amount time spent, I found out it all came down to some really confusing terminology on Authorize’s part. In our configuration, we had the api URL as “apitest.authorize.net”. This is the default value in the library and since our client’s account was in Test Mode, I figured this was correct. This is actually only for test developer accounts like I created. If using with a real account, in Test Mode or not, you need to point to api.authorize.net.

When testing with creating subscriptions, I often ran into an issue of duplicate subscriptions. If the inputs of a subscription creation call are too similar to a previous subscription, it will responds with an error explaining this. The inconvenient part of this is that the error response does not include the Subscription ID for you to update your data without extracting it straight from the error message. You can also manage the current subscriptions in your Authorize.net account dashboard.

If you run into any other issues, Authorize.net does provide a wonderful guide to the xml api. It offers some great samples for most calls you would need but more importantly it shows all error codes and descriptions so you can write your application with anticipation of these codes possibly happening.

How to Integrate Zendesk with WordPress

Zendesk is a fully-featured support tool, featuring support tickets, live chat, email messaging, and all the other things you need for supporting your business.

If you want the ultimate user experience, though, you don’t want to send your users away from your website, like, ever. Fortunately, Zendesk has made it possible to integrate your Zendesk account with WordPress.

The Zendesk and WordPress logins become one, once you install the plugin. And this means that you can easily manage both in one place: the administrative back-end. Zendesk’s WordPress plugin also makes the comments left on your pages and posts into support tickets, allowing for you to follow up personally with users. These thorough integrations make the plugin a no-brainer. That is, if you have a WordPress website…

Convinced? The installation of the plugin is extremely easy. Just go to your Administrator Panel in WordPress, then Plugins, and “Add New” Simply search for Zendesk and click “Install Now” when you’ve selected the correct plugin. After installation, you will need to add a few tidbits of information, such as your Zendesk login and unique login page.

Now that you have it installed, go to the Zendesk panel in your WordPress and note that Zendesk will create a div on the page you wish (or on all pages). By default, it will generate a floating (absolute positioned) “support” tab on your website. This can be formatted with the zendesk.css file inside the plugins directory.

Now if you want a more customized solution, you can use this code to include it on your page.

<?php if ( function_exists( 'the_zendesk_dropbox' ) ) the_zendesk_dropbox(); ?>

Or you can be more sophisticated and use their API to generate a JavaScript:

<script type="text/javascript">
 if (typeof(Zenbox) !== "undefined") {
	    Zenbox.init({
	      dropboxID:   "12345678",
	      url:         "https://yourdomain.zendesk.com",
	      tabID:       "Support",
	      tabColor:    "black",
	      tabPosition: "Left"
	    });
 }
</script>

The rest is mere styling, because integrating Zendesk with WordPress is so easy to do!

Why Will My Form Not Validate?

After spending nearly four hours debugging a script, there is a definite answer. But before I give you the answer, let me walk you through what happened.

I’ve validated forms before using the jQuery.validate.js extension. It’s definitely the easiest tool to use for form validation, since it doesn’t require any special divs or spans to display its error messages. (Although, if you wanted to display the messages in special divs, there’s a way to do that as well.) All you do is code your html form, making sure to give every input to be validated a proper id. Then you create a rule in your script (inside the $(document).ready (function()); This is important, because of what I’m going to say next.)

Your code will look something like this:

$(document).ready(function () {
	$("#form").validate({
		rules: {
			fname: {required:true, minlength: 2},
			lname: {required:true, minlength: 2},
			address:{required:true, minlength: 5},
			city: {required:true, minlength: 2},
			state: {required:true, minlength: 2},
			zip: {required:true, minlength: 5},
			phone: {required:true, phoneUS:true},
			email: {required:true, email:true},
 
		},
 
		messages: {
			fname: " Please enter your first name",
			lname: " Please enter your last name",
			address: " Please enter your address",
			city: " Please enter your city",
			state: " Please enter your state",
			zip: " A 5-digit zip code is required",
			email: " Valid Email Required",
			phone: " Valid US Phone Number Required"
		}
	});
});

In order to get the phone number validated, you will need to add a method, which you can just cut and paste in before the $(“#form”).validate() function and after the $(document).ready (function() {

	$.validator.addMethod("phoneUS", function(phone_number, element) {
	    phone_number = phone_number.replace(/\s+/g, ""); 
		return this.optional(element) || phone_number.length > 9 &&
			phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
	}, "Please specify a valid phone number");

Once you have your rules and messages defined, you’re almost there. The only other thing is to handle the form submission. My favorite way of doing this is using a submitHandler, which disables the form from submitting until it is validated. If you need to use AJAX, the submitHandler method will also allow submission via AJAX.

		submitHandler: function(form) {
			$("#form2").submit();
		}

 

So your final form validation will look like this:

$(document).ready(function () {
	$.validator.addMethod("phoneUS", function(phone_number, element) {
	    phone_number = phone_number.replace(/\s+/g, ""); 
		return this.optional(element) || phone_number.length > 9 &&
			phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
	}, "Please specify a valid phone number");

	$("#form").validate({
		rules: {
			fname: {required:true, minlength: 2},
			lname: {required:true, minlength: 2},
			address:{required:true, minlength: 5},
			city: {required:true, minlength: 2},
			state: {required:true, minlength: 2},
			zip: {required:true, minlength: 5},
			phone: {required:true, phoneUS:true},
			email: {required:true, email:true}
		},

		messages: {
			fname: " Please enter your first name",
			lname: " Please enter your last name",
			address: " Please enter your address",
			city: " Please enter your city",
			state: " Please enter your state",
			zip: " A 5-digit zip code is required",
			email: " Valid Email Required",
			phone: " Valid US Phone Number Required"
		},

		submitHandler: function(form) {
			$("#form").submit();
		}
	}); 
});

Now that your form is validated, everything should work, right?

Well, not necessarily. This is the time to get out your FireBug and see what the console says. I was getting a “form is null” error. This means that the form has not yet loaded on the page. The $(document).ready function calls when the page is delivered to the browser, even if not all of the material has finished loading. So if you’re using WordPress, the code must be after the wp-head() function.

So, make sure that when you are using WordPress, that you are putting your jQuery after the wp-head() function and you’ll be very glad you did. This principle holds true anytime your page is dynamically created, because client side scripts start running before the entire page hits the browser, meaning that code not yet delivered can’t be selected by jQuery.