Hi,
I have a time field (Start time) that when someone enters the time, I automatically want to add 1 hour to the end time (another column) and have it show in either the add view or the grid itself.
Is it possible to do this?
Thanks – Greg
You can use onblur event of start time field, and invoke a JS function that will change the end time (using jquery or plain js).
Refer faq: Q) How to populate other column, based on previous columns.
http://phpgrid.org/faqs
I tried that code and put an alert(); into the function.
When I entered the cell and/or left it would never fire.
I looked at some other previous posts and the above does not seem to support inline editing correct (or has that changed)?
Do I need to do the ExcelView integration to have this work with inline?
I was trying to get it to work just by editing the record in the edit view (similar to the add view).
Thanks – Greg
In any demo, e.g. demos/appearance/group-header.php you can try adding following line:
$col["editoptions"]["onblur"] = "$('#company').val( $('#name').val()+' company' );";
It will auto set company field onblur of name field.
$col = array();
$col["title"] = "Name";
$col["name"] = "name";
$col["editable"] = true;
$col["width"] = "80";
$col["editoptions"] = array("size"=>20);
$col["editoptions"]["onblur"] = "$('#company').val( $('#name').val()+' company' );";
$cols[] = $col;