Hi.
Can i get current value of field for un parameter of set_relation .
I have this table :
CREATE TABLE personne( numpersonne serial NOT NULL, nom character varying(20) NOT NULL, prenom character(20) NOT NULL, datenaissance date, codepostalpers bigint NOT NULL, ---------- refcommune integer, ---------- ...
refcommune is a foreign key and i use set_relation to the table commune :
CREATE TABLE commune( numcommune serial NOT NULL, commune character varying(50) NOT NULL, codepostal character(5) NOT NULL, CONSTRAINT pk_commune PRIMARY KEY (numcommune ) )
my code
$crud->set_theme('datatables'); $crud->set_table('personne'); $crud->fields('nom','prenom','datenaissance','codepostalpers','refcommune'); $crud->set_relation('refcommune','commune','{codepostal} - {commune}', array('codepostal' => XXXXXXXXXXX) );
In set_relation with the 4° parameter : With the constant '31000' for codepostalpers it's Ok
I have the rows of commune with '31000'
$crud->set_relation('refcommune','commune','{codepostal} - {commune}', array('codepostal' => '31000') );
but i want to use the current value of codepostalpers of my table personne
$crud->set_relation('refcommune','commune','{codepostal} - {commune}', array('codepostal' => XXXXXXXXXXXXXXX) );
How replace XXXXXXXXX by the field codepostalpers of my grid ?
THX for help and time.