Showing posts with label Form Validation. Show all posts
Showing posts with label Form Validation. Show all posts

Thursday, September 3, 2009

Check-box Confirmations and Web Forms



Today's post on Artisan is another guest post, this time from Ben McPhee, on our Product Management team. Ben is most well known for his recent work on Prospect Profiler, one of our keys to sales enablement, but he is also responsible for our work with the sports marketing vertical where we work with a number of professional sports teams, arenas, and racing facilities.


Ben's work in this area leads to him bringing some interesting requirements to the table, and gives him some unique experiences that are of value to a broader set of marketers. In today's post, he explores the use of validation rules to ensure that a visitor has checked a check-box on a form that indicates that they are of a certain age, or have read the terms and conditions. This is a useful technique for many marketing situations.




=================================



Do you require visitors to agree to particular terms and conditions before you can accept the data they are providing through a form? Do you require a checkbox to be checked before accepting a form submission? Well, you don't need to be an HTML or JavaScript expert to set this up in your Eloqua forms.


Check out the simple instructions below to show you how to do this yourself!



First, add the checkbox field to your form. From the Fields menu on the form, you can list the fields in your form, or add a new field. If this is a form hosted within Eloqua, you'll need to add the field, if it is hosted on your site you will have already captured the field.

For this example, we'll look at a Checkbox field type, but the same techniques can be used on any type of field.





Next, go to the Form menu and select "Edit Server Validation" to edit your server-site validation (the process that runs after the submission of your form to ensure that people have filled in the information you require).


You can set the rules to validate against, the fields to validate, and the error pages to display if the field is incorrect.

To set up validation, first select an Error Page that will be presented to submittors if the info they have provided DOES NOT meet the requirements you set. When you have done this, select the field to validate (the checkbox field you added to your form) and create a NEW validation rule.




You'll be looking for the value submitted by the checkbox field to be "on", so select "Field value in Data Set" as your Validation Type - this is essentially saying, "I'd like to validate that the checkbox has been checked by comparing what is submitted to a list of acceptable submissions".

Selecting this give you options below that you need to configure to define exactly what the form validation should be looking for. Go to the "Form Field Validation Parameters" area of the page to define that list of acceptable submissions. To do this you will be creating a new Data Value Set and saying, "Do not accept a form submission unless the value submitted in this checkbox is in this Data Value Set".


Give your Value Set a name (in this example, "Checkbox- Must Be Checked", and then as your value, enter the value "On". The reason you are entering "On" is because by default, when a checkbox field in a form is checked, the system passes in a value of On or blank, depending on whether or not the box was checked.

With that validation set (of just one value - "On") created, you'll return to the previous page. Make sure that you have the "Set to the default value..." option Un-Checked so that your form submission is not altered.

And you're done! With this technique you can quickly ensure that no forms are submitted unless the right checkboxes are checked.

Friday, January 2, 2009

Eliminating form spam with a quick Captcha


An annoying thing about most forms that make their way onto the web is that they get discovered by automated spam robots that submit their garbage information, and in doing so, invalidate your numbers, and give you extra cleanup effort in order to ensure that only clean data enters your databases.

Luckily there's a quick and easy way to fix that - you have probably seen it if you've ever commented on a blog or signed up for an account on any free service. It's called a CAPTCHA - an acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart.", and in it's most common form, it uses a randomly generated image of a word or letter sequence that you have to type in in order to allow your form to be submitted.

On many less critical sites, it is also done with a simple human-readable request, and verification of that against the known correct answer. Many blog sites like Marketing Profs Daily Fix(http://www.mpdailyfix.com/) and Six Pixels of Separation (www.twistimage.com/blog) use this technique successfully.

There's a simple and easy way to do this with Eloqua, and while it won't prevent form spam from someone who exerts significant effort on your specific web form, it's quick and easy and will prevent almost all form spam from bots that discover your form by trawling the web.

First, create a text field on your form, called Captcha Field, where you will ask a user to submit a word, or the answer to a question.

Then, from the top menu, add server side validation to the form by choosing "Edit Server Validation". We will be verifying that the submitted answer to the Captcha question matches the correct answer, and this should only be the case if it is a human, not a spam bot, submitting the form.

We'll use server side validation (after the form is submitted) as most spam bots will bypass any of the javascript client side validation that one can use (before the form is submitted).

Add a new validation rule on the Captcha field, and make that validation rule of the "Field Value in Data Set" type. This will verify that the value submitted is part of a set of acceptable values, although in our case, the "set" of values is likely to only contain one value. However, if you think that the human-readable question might have more than one possible way of phrasing the answer, you might want to add both (ie, if you ask "what is 2 + 2", you might want to add "four" and "4" as possible answers.

The validation parameters have an option for setting the value to a correct value if it is not correct, but we will not enable that as that would correct the spam bot's answers and allow them through, defeating the purpose.

Create a new Data Set called Captcha Values, and in that set, add in your accepted answers. In our case, if we have the instruction on the form say "type in the word 'notaspammer'", we would add "notaspammer" to our correct value list. You can use words, answers to simple questions or very simple (2 + 2) math questions. Remember that you're only able to stump automated form trawlers, not dedicated efforts with this technique, so keep it simple.

Add the field to your form layout, and instead of the normal field name, type in your Captch question. Next, configure a message that alerts them that the field was not correctly filled out in the case of an error, and you will have a basic Captcha for your form.

I look forward to your comments on this technique, what has worked, what hasn't, and what percentage of spam bots you have found this to resolve.