04 Feb 2010 @ 5:21 AM 

Rapyd has some pretty useful validation rules. Pretty much all the ones that are in CodeIgniter + a few more

first create your edit grid

$edit = new dataedit_library();
$edit->label = $this->title;
$edit->back_url = site_url('users_list');
 
$edit->source('user');

Here are some of the lesser well known ones:

unique[table_name] – if you use this validation rule, rapyd will make sure that the field you are using the rule on is unique in table_name

$edit->field('input','user_idnumber','ID Number')
    ->rule('exact_length[13]|unique[user]')
    ->rule('numeric');

valid_email – this will make sure the field is a valid email address

$edit->field('input','email','Email Address')
        ->rule('valid_email');

in_range[low,high] – this will make sure that the value you enter is between (low) and (high)

$edit->field('input','selling_incl','Selling (Incl VAT)')
    ->rule('required|in_range[' . $avg_cost . ',' . $real_value . ']');
Posted By: Zayin
Last Edit: 04 Feb 2010 @ 05:21 AM

EmailPermalink
Tags
Tags: ,
Categories: php, rapyd


 

Responses to this post » (One Total)

 
  1. zayinkrige says:

    New Blog Post -> Rapyd – CRUD for PHP – Part 4 – Validation – http://www.zayinkrige.com/rapyd-crud-for

Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.


 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 38
  • Comments » 61
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Links



    No Child Pages.

Portfolio



    No Child Pages.