This topic is locked

custom code on inline edit page

4/17/2008 8:16:14 AM
PHPRunner General questions
T
thesofa author

Hi,

I am using inline edit to assign a date to some records, one at a time.

When a date is assigned, I need to change the ownership of the record from the existing logged in user who is editing the record to another person. I am intending to do this change with a snippet of custom code along the lines of

If [field1] is not null, make value[field2] = value[field3].

I would like this to occur when the user clicks the green tick to save the record.

I realise that this will then take ownership of that record from the logged in user and it will prevent further editing by that user.

Is this the best way to do this or is there a clever bit of javascript that will do it instead?

TIA

J
Jane 4/17/2008

Hi,
use Edit page: Before record updated event on the Events tab for this purpose.

All events for simple add page work for inline edit too.
Here is a sample:

if ($inline)

{

if ($values["field"])

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

}

T
thesofa author 4/18/2008

Hi,

use Edit page: Before record updated event on the Events tab for this purpose.

All events for simple add page work for inline edit too.
Here is a sample:



Hi, I have tried that and I get an "error occured>>" in grey appear below the key ID field, this scrolls out to read "Record was not updated, Duplicate entry `101-2008-04-23-1` for key 1"

Does this mean that MySQL creates a new record to suit the old data and modifications and then deletes the old data record?

The key is made up of the number of the pupil, the date and the session number.

J
Jane 4/18/2008

Hi,
simple edit and inline edit work in the same way.

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.