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.
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, ...