This topic is locked

i want to set a value in the beforedit event

11/12/2007 12:23:06 PM
PHPRunner General questions
M
mounir author

i have a field "last_update_date" that i want to update eache time before loading the edit page

so in the befor edit event i do
[codebox]$cur=date("Y-m-d");

$values["last_update_date"]=$cur;[/codebox]
but in the value is not changed in the edit page !!
i can update the value after editing but i wanna change the value before editing
thank you for the help

A
alang 11/12/2007

In before display event try:
$cur=date("Y-m-d");

$smarty->assign("value_last_update_date",$cur);

M
mounir author 11/13/2007

In before display event try:

$cur=date("Y-m-d");

$smarty->assign("value_last_update_date",$cur);



thanks for answering me

i use phprunner 4.0

i have to clairify some things !! first i have only an Onload event ( is it the "before display" event u mention )

here is my code now [codebox]function EditOnLoad()

{

global $where;

//include('libs/Smarty.class.php');

$smarty = new Smarty();

// Parameters:

// $where - string with WHERE clause pointing to record to be edited

//** Custom code ****

// put your custom code here

$cur=date("Y-m-d");

$smarty->assign("value_last_update_date",$cur);

$all_tpl_vars = $smarty->get_template_vars();

// les affiche a l'écran

print_r($all_tpl_vars);
}

[/codebox]

the result : <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23293&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
// print_r($all_tpl_vars);

Array ( [SCRIPT_NAME] => /AtriumAdvisorV2/site_info_edit.php [value_Last_Update_Date] => 2007-11-13 )
but the field Last Update Date : is still keeping the database value : Last Update Date 2007-00-00 !!
in the php runnner 4.0 for that field i have :

last_update_date as name of the field in the database

Alexey admin 11/13/2007

Hi,
either upgrade your PHPRunner to version 4.1 and put the code to Before page displayed event

or put the code to generated ..._edit.php file.

Put it in the end of file just before $smarty->display(..) statement.