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 />'; |

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 
New Blog Post -> Rapyd – CRUD for PHP – Part 4 – Editing Data – http://www.zayinkrige.com/rapyd-crud-for…