How to add word's filter in each field?

joao 23 Apr, 2010
Hi mates!

I would like to know if Chrono Forms has the possibility to add some specific words in each field.

For example: In the field "A" add filter for these words "123", "car", etc... So if someone put those words I will not receive the form.

Any help you be very welcomed!
Thanks all. :wink:
nml375 23 Apr, 2010
Hi Joao,
Short answer, yes this is fully possible.

A little longer answer;
Client-side, there's the Form Validation feature of ChronoForm, which uses the LiveValidation javascript library to add validation to your form inputs. You can add different predefined classes of validation simply by using the controls on the Validation tab. You could further create your custom validations, if the pre-made are not suitable. You'll find several threads on the forum with details to add these.

Server-side, there's the option of adding a set of PHP-code to test each submitted data against your own criterias, and stop processing of the form if any of your tests fails. This will require some knowledge in PHP-coding, as there are no pre-defined validation types.

If your objective is to prevent your visitors from accidentally submitting an incomplete form, the client-side validation is usually the most user-friendly approach. On the other hand, if you are trying to thwart spambots, server-side validation is the only reasonable option.

/Fredrik
joao 23 Apr, 2010
Hi Fredrik! thanks for reply.

Unfortunately I haven't knowledge in codes, I didn't understand... I thought I could define these words just typing in some area. There is another way to make it?
nml375 23 Apr, 2010
Hi Joao,
Have you had a look at the "Validation" tab in your form editor?

To setup the client-side validation, you simply enter the form field names in the appropriate boxes, and select "yes" on the option to enable validation. You'll find 13 predefined types of validation here, if none of these apply, then you'll have to code your own. There are several good threads covering this on the forum - usually a search for "LiveValidation" or "custom validation" will help you find them.

Server-side validation is done on the same tab, though this requires some knowledge in PHP-coding. There are some examples on server-side validation on the forum as well, though not as common as the client-side validation. The rough concept however, is something like this:
<?
if ($_POST['accept'] != 'yes') {
  return "You have to accept.";
}
?>

In this rough example, we test if the form input called "accept" has the value of "yes". If it does not, we stop the form, and tell the user "You have to accept.".

/Fredrik
This topic is locked and no more replies can be posted.