This topic is locked
[SOLVED]

 Auto fill based on 2 other fields

3/31/2017 11:22:39 AM
PHPRunner General questions
K
kernal author

Hi,
I'm using PHP Runner 9.7 Build 28347 and I am wondering if it is possible to autofill a text field, based on two other text fields. For example, I have field1, field2, and field3. field1 = "A" field2="B", I would like field3 to automatically be "AB"
Is this possible?
Thanks

lefty 3/31/2017



Hi,
I'm using PHP Runner 9.7 Build 28347 and I am wondering if it is possible to autofill a text field, based on two other text fields. For example, I have field1, field2, and field3. field1 = "A" field2="B", I would like field3 to automatically be "AB"
Is this possible?
Thanks


See this link - without autofill should work for you . For MYSQL database if you are using.

Use Query

romaldus 3/31/2017



Hi,
I'm using PHP Runner 9.7 Build 28347 and I am wondering if it is possible to autofill a text field, based on two other text fields. For example, I have field1, field2, and field3. field1 = "A" field2="B", I would like field3 to automatically be "AB"
Is this possible?
Thanks


You can do it in before record added event

$values["field3"]=$values["field1"].$values["field2"];
lefty 3/31/2017



You can do it in before record added event

$values["field3"]=$values["field1"].$values["field2"];




Yea that's even faster and easier . both ways will work.

K
kernal author 3/31/2017

Thanks you... been struggling with that one for a while... was trying to use + instead of . and kept getting an answer of 0. :-)

romaldus 3/31/2017

If you want to autofill field3 on the fly, use javascript onload instead



var ctrlField1 = Runner.getControl(pageid, 'field1');

var ctrlField2 = Runner.getControl(pageid, 'field2');

var ctrlField3 = Runner.getControl(pageid, 'field3');
function func() {

ctrlField3.setValue(ctrlField1.getValue() + ctrlField2.getValue());

};

ctrlField2.on('keyup', func);

ctrlField3.on('keyup', func);


H
Hertz2P 4/1/2017



Thanks you... been struggling with that one for a while... was trying to use + instead of . and kept getting an answer of 0. :-)


It sounds like you should mark this one "solved"