O'Reilly logo

Drupal 7 Webform Cookbook by Douglas Vernon Denny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating submitted data

Our final step is to define the validation processing for our IMEI component. Previously, in our component render function, we set one validation function that would always be executed and another which would only be executed if we specified that data submitted to our component should be unique. Along with these, we also need a helper function to perform the Luhn algorithm check digit calculation and verification as described at the beginning of this chapter.

How to do it...

Let's get these validation functions coded up in webform_imei.module so that we can complete the project and finally get to test our new component:

/** * Form API Validation function to validate IMEI numbers on client form. */ function webform_imei_validate_imei($form_element, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required