First Form

One of my favorite WordPress plugins is Contact Form 7. When using it to make forms for clients, there are two important issues to tackle. The first issue is to make sure the form is works properly. This includes ensuring that the form looks presentable on screens of all sizes:

On a widescreen monitor (cropped)

On an iPhone

It is also important to make sure that the form validates data so the form only sends when the required information is entered properly (especially information like email addresses and phone numbers):

The form will not send because the email was not entered properly.

The second issue is to make sure that the contact form sends an email that is concise and easily recognized by the client. Knowing HTML isn’t required but it sure is useful. The email that clearly shows the client exactly who is applying for a job (Homer Simpson, in this case), both as the sender and in the email. The applicant’s information is clearly listed and their cover letter and resume are conveniently attached:

This is the code for the contact form itself:

The asterisks within the brackets indicate that the field is mandatory.

This is the code for the email:

Second Form

I wanted to use the lessons from the first form to make the second form more sophisticated. Here’s a picture of the form as a whole:

Place Holders:

For the phone number field, I wanted to make sure that the applicant used only one type of format. I didn’t want them to use parentheses, hyphens, or periods. I didn’t want to take up space by placing text saying “No periods, hyphens, or parentheses” on the top, bottom, or sides of the field. I used the placeholder feature to show that text within the field itself:

I also did the same thing with the address section, to clarify the exact information I wanted entered in the fields:

Maxlenghts & Minlengths:

I was getting annoyed that the telephone fields would still send if I entered both more or less than 10 digits. I wanted the number of digits to be exactly 10.

Sample Telephone Code:

I first used the maxlength feature (in bold) to make sure that no more than 10 digits could be entered:

[tel Telephone /10]

This solved one problem. But the next problem was that I could enter 9 digits and the form would still submit. Contact Form 7 had no way to solve this. So I did a little Googling and found a plugin called Contact Form 7 minlength extension. This creates a minlength field in Contact Form 7 (highlighted in red):

This gives us the following code (minlength in bold) which ensures that, in order for the form to be submitted, there must be a maximum and minimum of 10 digits in the telephone field:

[tel Telephone /10 minlength:10]

I did the same exact techniques for the ZIP code field to make ensure a maximum andminimum of 5 digits in order for the form to be sent.

The form won’t send because there are less than 10 digits in the field.

Drop-Down Menu:

For the address portion of the form, I wanted the applicant to choose from a list of states. I chose the drop-down menu feature. I then pasted a list of state abbreviations (as well as DC) and came out with the following code:

Email:

For the email, I wanted to be a little more creative and use some inline CSS to make the email a little more visually appealing, but still keeping everything neat, concise, and minimalist. I chose a color scheme based on the client’s logo:

I also wanted to keep the applicant’s name in the subject line so the client can see who is sending the application. If it’s someone they don’t care for, they don’t even have open the email.

I would’ve liked to do more CSS tricks but the form was so limited that it felt rather unnecessary. This is the code for the email: