gsouza
|
| Posted: 08/09/2002, 9:41 AM |
|
I need to execute a PHP function and write the result on the page. In Code Charge Pro I could define a label, execute the function and assign the result to $fldLabelName on "Before Show" event, but how can I do it on Code Charge Studio ? What event should I use ? What is the variable's name ?
Thanks in advance
|
|
|
 |
Nicole
|
| Posted: 08/10/2002, 3:46 AM |
|
Hello,
put the custom function body into common.php file.
Add Label type field to the form or page, create Before Show event for this label. To assign it custom value use code like:
- for the field on the form:
global $form_name;
$form_name->field_name->SetValue("custom_val");
- for the field on the page (located outside form):
global $label_name;
$label_name->SetValue("any value");
|
|
|
 |
kangus
|
| Posted: 08/10/2002, 6:26 PM |
|
Nicole, your suggestion to place the function into the common.php file is a little confusing. Adding the custom code before show works but the minute I add:
function NumDaysLeft($futureDate){
return $DaysTillElection=(date("z",strtotime ($futureDate))-(Date("z")));
to the common.php file then add:
global $DaysLeft;
$DaysTillElection=NumDaysLeft("5 November 2002");
$DaysLeft->SetValue("Number of days left until the ELECTION is: ".$DaysTillElection);
to the Custom Code of the DaysLeft Label everything blows up.
Can not find the function.....
|
|
|
 |
|