php - Split Input for use with Bank Numbers (input split into sections) -



php - Split Input for use with Bank Numbers (input split into sections) -

i not seem able find reply this, though looking @ wrong thing. have yii application able create accounts , store peoples data. 1 such piece of info persons iban number. have single text input people can type country code , 22 digits necessary. able validate , error or save accordingly. 1 thing able have split input box. in single input iban appears so: es0012345678912345678912

i split so: es00 1234 5678 91 2345678912

this makes much more user friendly , easy read. can alter way looks on view when editing have 5 input boxes in single row, 1 takes 4, next 1 4 characters, next 1 4 etc. illustration of mean:

can please point me in direction of how achieved. there type of split input can use, or need create 5 separate inputs , bring together them on submission , validate here? ability split saved entry across these 5 boxes much easier.

many thanks

as suggestion, if utilize model, add together attributes below:

class modelname extends cactiverecord { public $ibannumber; public $ibannumberpart1; public $ibannumberpart2; public $ibannumberpart3; public $ibannumberpart4; public function beforevalidate(){ if(parent::beforevalidate()){ $this->ibannumber=$this->ibannumberpart1.$this->ibannumberpart2 ... homecoming true; } } //then write rules , on ...}

by adding $ibannumberpart1..4 properties model, know of them model attribute. can add together 4 fields in view name ibannumberpart1 , on. possible write validations rules each attribute. example:

public function rules(){ homecoming array( array('ibannumberpart1','required'), array('ibannumberpart1','numerical','integeronly'=>true), ); }

by this, split input 4 parts, , have of them 1 field called $ibannumber.

php html yii

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -