Stay tuned Watch us Facebook Twitter

Thanks! We`ll keep in touch.

Sign up for our Peggy Journal

Get the latest Peggy Forms news, features and great offers!



Input validation.

Validation is very important in most forms to successfully setup and use your forms. There are a lot of ways to validate users input.

There is the required validation feature for every field. It is also possible to validate a field to match a specific format. This type of validation is highly recommended for the email field.

Use validation with date fields to have a minimal or maximum date, or just use today as variable. It can be useful if you need some time before a booking or appointment.

Submission limitations

Submission limitations are very useful if you need a limitation in your form. Let’s say, for example, that you offer workshops on three times a day and that you have a maximum of bookings for every workshop.


Just use a choice field, whether it is a radio button or checkbox, and set the limitations for every choice. With that your workshops can never be overbooked.


View example

Types of validation

Peggy Forms has several types of validation like using regular expressions, dates or HTTP requests.

1. TextInput

Use a preset or define your own input validation using regexp:

2. Datefield

Date fields can be setup to have a min or max date, or use today as variable. For example: you can have an date field which only allows from 4 days after today to end of this year. See example.

3. Deny duplicates

To avoid double submissions for in example the same email address, we provide the 'deny duplicates' feature. If enabled on a text input there is only 1 submission allowed with the same content.

4. Limitations

PeggyForms provides also something very usefull: you can setup choice fields (like radiobuttons and checkboxes) to have submission limitations.
For example: if you have a choice for 3 dates for your workshop with limited place, you can setup as follow:

PeggyForms allows you to configure how many submissions each item can have, say: 10 for all the 3 options. If 10 people choosed Monday 7PM then that option will be disabled from that moment on.See an example here.

Using webservices

If you need your own business logic for validation, you need the Developer Plan. With this plan you get a load of HTTP/Ajax features, including HTTP input validation without using to write hard javascript codes!

Use AJAX/HTTP request to validate your form or specific fields, and use the HTTP-response for rules or feedback messages. The setup for this is very easy. In this example we added url https://my-api-url/api.php which contains the businesslogic for validation.
We added 2 parameters, 1 static parameter: fixed-value. And 1 dynamic parameter based on user input.

The API shoud return in JSON format like this:

{   "result": "OK",   "success": true,   "message": "",   "hasProp": true,   "prop": "" }

result (required) should be OK or NOK or INIT for validated, not validated and undecided (mostly used for initial state).
success (required) should be true if the request was successful or false if there was an error
message (optional) is used to show a custom validation message if the validation failed. This wil override the message you entered in the Peggy Forms editor.

You can provide extra properties which you can use in other form fields, for example to show extra information in a text block:

And/or you can use these properties in the logic/rules to, for example, show a field only when the hasProp property equals true:

If you still need help, view this quick video tutorial.

View example

Read more about using webservices in your form

Continue reading