When your form is submitted, it will pass through a validation function if you define one. The function name should be nameofyourform_validate($form, &$form_state)<br><br>See <a href="http://drupal.org/node/751826">http://drupal.org/node/751826</a> (The Drupal forms quickstart guide).<br>
<br>This function will be automatically called when a user submits your form. Inside this function, you can check on the values of $form and use PHP's is_numeric to be sure that $form_state['ci'] is a numerical value. If it is not (that is, if is_numeric returns FALSE), use form_set_error to invalidate the submission and return the user to the form page with an error message.<br>
<br><div class="gmail_quote">On Thu, Mar 10, 2011 at 11:46 AM, Damian Adriel Perez Valdes <span dir="ltr"><<a href="mailto:damian.adriel@gmail.com">damian.adriel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello:<br><br>I need your help. I'm making a Drupal module, and i need to validate if the textfield data are numeric or not. can i use a drupal functions for this ?<br><br>This is my form code:<br><br> 'ci' => array ( <br>
'#title' => t('C.I.'), <br> '#type' => 'textfield', <br> '#maxlength' => 11, <br> '#size' => 20,<br>
'#required' => TRUE,<br> ),<br clear="all"><br>Thanks.<br><br>
</blockquote></div><br>