04 Feb 2010 @ 5:28 AM 

This data edit sample uses some of the nicer features of Rapyd editing, namely:
1) Field Editing
2) Drop down lists (static and dynamic from db)
3) validation
4) Hidden fields

        $edit = new dataedit_library();
        $edit->label = $this->title;
        $edit->back_url = site_url('users_list');
 
        $edit->source('user');
        $edit->field('dropdown','customer_id','Customer')
            ->options('SELECT customer_id, company_name FROM customer')
            ->rule('required');
        $edit->field('input','user_firstname','First Name')
            ->rule('min_length[3]|max_length[20]');
        $edit->field('input','user_surname','Last Name')
            ->rule('min_length[3]|max_length[20]');
        $edit->field('input','user_idnumber','ID Number')
            ->rule('exact_length[13]|unique[user]|numeric');
        $edit->field('input','email','Email Address')
                ->rule('valid_email');
        $edit->field('dropdown','province_id','Province')
            ->options('SELECT province_id, province_description FROM province where country_id = 1')
            ->rule('required');
        $edit->field('dropdown','country_id','Country')
            ->options('SELECT id, name FROM country')
            ->rule('required');
        $edit->field('dropdown', 'security_role_id', 'Security Role ID')
            ->options(array("1"=>"Administrator", "2"=>"User"));
        $edit->field('hidden','security_role_id','Security Role ID')->insert_value(2);
        $edit->field('hidden','activated','activated')->insert_value(1);
        $edit->buttons('modify','save','undo','back','delete');
        $edit->build();
        $data['head']    = $this->rapyd->head();
        $data['title']   = $this->title;
        $data['content'] = $edit->output.'<br />';
Posted By: Zayin
Last Edit: 04 Feb 2010 @ 05:28 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 – Editing Data – 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.