Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: form field validation (numeric or empty only)

    Im writing a validation class for ZC, (already finished but havent posted yet) you can have a look if you want.

    https://svn.rubikintegration.com/zen...validation.php
    For example, to check if the customers_email_address passed in POST is not empty and is valid email:
    PHP Code:
    $yvalidation = new yvalidation();
    $rules = array('customers_email_address' => array(array('validation_is_not_empty'=>''),
                                             array(
    'validation_is_email'=>'')));
    $yvalidation->set_params($_POST);
    $yvalidation->set_rules($rules);
    $error_counter $yvalidation->run(); // store the number of errors here 


    Multiple fields can be checked at once, each field can be checked against multiple rules.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  2. #2
    Join Date
    Nov 2007
    Posts
    270
    Plugin Contributions
    0

    Default Re: form field validation (numeric or empty only)

    Quote Originally Posted by yellow1912 View Post
    Im writing a validation class for ZC, (already finished but havent posted yet) you can have a look if you want.

    https://svn.rubikintegration.com/zen...validation.php
    For example, to check if the customers_email_address passed in POST is not empty and is valid email:
    PHP Code:
    $yvalidation = new yvalidation();
    $rules = array('customers_email_address' => array(array('validation_is_not_empty'=>''),
                                             array(
    'validation_is_email'=>'')));
    $yvalidation->set_params($_POST);
    $yvalidation->set_rules($rules);
    $error_counter $yvalidation->run(); // store the number of errors here 

    Multiple fields can be checked at once, each field can be checked against multiple rules.
    Thanks, I will take a look..
    for now I just did as follows (and it works for me):
    Code:
          
     if(ereg('^[\s0-9]*$', $a-item1) === false){
        $error = true;
        $messageStack->add('silentauction', 'Leave empty, or enter only numbers (dollar amount, no cents) in your bid input box 1!)');
     }
    if ($a-item1!='' && $a-item1<= 600){
      $error = true;
      $messageStack->add('silentauction', 'Your bid for Fall Buck is equal or bellow the reseved bid of $600!)');
    }

  3. #3
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: form field validation (numeric or empty only)

    Yeah, just do whatever works for you ^^.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

 

 

Similar Threads

  1. form validation - email address field
    By kwright in forum General Questions
    Replies: 1
    Last Post: 18 Sep 2010, 01:52 AM
  2. Custom Form Field and Email Validation
    By zepher in forum Managing Customers and Orders
    Replies: 4
    Last Post: 26 Jan 2010, 12:45 AM
  3. how to increase admin invoice address numeric field?
    By guitarmong in forum General Questions
    Replies: 0
    Last Post: 18 Dec 2009, 02:55 AM
  4. Custom form: Field Validation
    By amites in forum General Questions
    Replies: 3
    Last Post: 8 Jun 2007, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg