This topic is locked

Inline edit default field value when starting edit

6/26/2017 3:07:42 AM
PHPRunner General questions
H
headingwest author

Hi All,
I have an inline edit where a field defaults to zero

When the user inline edits that field, I want the value to fill with another field on the same row if that number is zero
Eg, here is my row:

FIELD1 FIELD2 FIELD3

apples 3 0

oranges 8 0
When apples clicked for edit
FIELD1 FIELD2 FIELD3

apples 3 [3] <-- gets filled with another column if zero.

oranges 8 0


So far I've tried javascript but the on'focus' event doesn't fire when you first click on the field
Also tried changing the default and autoupdate to $data['field2] and $values['field2']
Any ideas??

admin 6/26/2017

Use Javascript OnLoad event and getValue()/setValue() functions.

H
headingwest author 6/26/2017



Use Javascript OnLoad event and getValue()/setValue() functions.


I've tried that Sergey but you can enter the field and start typing without the new default value. It's like 'focus' is skipped.
To replicate:

http://demo.asprunner.net/jim_storey_divacoffee_com_au/test/dd1_list.php
Click on the word "Zero" and start typing, it should change to "XXXXXXXX". Try to click once, then click again.
Is there an event "start_inline_edit" that I can access??
Here is the onload:



var ctrl = Runner.getControl(pageid,'description');
function func(){

ctrl.setValue('XXXXXXXXX');

}
ctrl.on('click', func);

ctrl.on('focus', func);


I will raise this by email as a possible bug when "click action" = "inline edit"