Hello,
I'm having numerous childrecords 'visit' for the same master.
I would like to autofill a field for the next (subsequent) child record field from the previous child.
Let's say a value for the same field A, where 'SubjectId' is foreign key and 'id' is primary autoincremental key from the identical field 'A' from the similar record having the same 'SubjectId' and different 'id'.
However I would like to see these values on load. What event to use, AdOnLoad or Before Display, and what to change in code correspondingly?
In beforeAdd event, I would be something like
[codebox]global $conn,$where,$strTableName;
$str = "select visit.A from visit where SubjectId=".$_SESSION[$strTableName."_masterkey1"];
$rs = db_query($str,$conn);
$data = db_fetch_array($rs);
$values['A']=$data['A'];
return true;
[/codebox]