This topic is locked

Date&time from field is now() when otherfield is..

11/3/2005 5:33:39 AM
PHPRunner General questions
OCTheEagle author

I have the following situation:
Table: Dossiers
Four fields: (as given in phprunner)

  • Dossiers received (fieldbox)
  • Date dossiers received (date-time)
  • Design done/sent (radio button with value 'done' or 'sent')
  • Date design done/sent (date-time)
    When you check off 'dossiers received' the current date and time will be added to the field 'date dossiers received'. When you uncheck 'dossiers received' the date and time from 'date dossiers received' will be deleted.
    When you choose 'done' or 'sent' at 'design done' the current date and time will be added to 'date design done/sent'.
    Is this possible?

admin 11/3/2005

Hi,
this can be done by adding custom code into ..._edit.php file.

You can put your code just before this snippet:

  foreach($evalues as $ekey=>$value)

      $strSQL.=$ekey."=".$value.", ";


You can get the values to be written to database by accessing $evalues array. Also you can change these values. I.e.

if($evalues[`Field1`]>0)

  $evalues[`Field2`]='Positive';

OCTheEagle author 11/4/2005

Unfortunately I can´t seem to get that working.

I´ve made a small table with 2 fields: ´Check´ and ´Text´When you check the checkbox in field 1 then the text in field 2 should be ´okay´.

The code would be like this.

if($evalues[`Check`]>0)

$evalues[`Text`]='Positive';
Still, the field in ´text´ always stays empty.

admin 11/4/2005

The actual value of $evalues[`Check`] depends on the type of Check database field.
You can issue print_r($evalues) to determine the actual values to be written to table row.