saseow
Posts: 744
|
| Posted: 02/16/2005, 6:27 AM |
|
I have tried every example from the forums and from the help files with no success at all.
All I want to do is add a label to a page and assign some text to it in the before show event.. The last thing I have tried is the "Adding a Label to the Page" in the help file step by step. The code it produces is:
//Retrieve Value for Control @7-0145785F
global $header_participants;
$header_participants->Label1->SetValue("Testing");
//End Retrieve Value for Control
The error it gives is:
Fatal error: Call to a member function on a non-object in C:\php Webs\mindfeel\header_participants_events.php on line 30.
If anyone can shed some light on this ..... you have no idea how happy I would be. I have spent about 4 hours trying various code to get this working.
Thanks,
Trevor
|
 |
 |
aradi
Posts: 66
|
| Posted: 02/16/2005, 7:49 AM |
|
Hi,
As i understood you question that you want to show the content of a label on a page. After adding the Label ( i call it LabelName) to the page just do the following:
in design mode:
1- Click on the label
2- choose Events in the properties window
3- choose Before Show ->Add code
4- After "Global $labelName" add :
$Label1->SetValue("Testing");
Your code should look like this :
global $LabelName;
$LabelName->SetValue("Testing");
This is one way to do it.
|
 |
 |
aradi
Posts: 66
|
| Posted: 02/16/2005, 7:53 AM |
|
oops Typo mistake in #4 should be
$LabelName->SetValue("Testing");
|
 |
 |
saseow
Posts: 744
|
| Posted: 02/16/2005, 9:45 AM |
|
Thanks for the reply aradi! I would have thought that this would worj as well but i get the following error:
Fatal error: Call to a member function on a non-object in C:\php Webs\mindfeel\header_participants_events.php on line 33
My code is:
//Custom Code @7-1E8335A6
// -------------------------
global $header_participants;
global $Label1;
$Label1->SetValue("Testing");
// Write your own code here.
// -------------------------
//End Custom Code
Any more ideas?
|
 |
 |
Martin K.
|
| Posted: 02/16/2005, 10:02 AM |
|
Hello.
Mybe this works?:
My code is:
//Custom Code @7-1E8335A6
// -------------------------
global $header_participants;
$header_participants->Label1->SetValue("Testing");
// -------------------------
//End Custom Code
Greets Martin
|
|
|
 |
saseow
Posts: 744
|
| Posted: 02/16/2005, 8:25 PM |
|
Thanks Martin for the answer but I still get the following error:
Fatal error: Call to a member function on a non-object in C:\php Webs\mindfeel\live_participant_answers_events.php on line 25
This has really got me stumped!
|
 |
 |
peterr
Posts: 5971
|
| Posted: 02/16/2005, 8:41 PM |
|
Is this an includable page?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
saseow
Posts: 744
|
| Posted: 02/17/2005, 5:36 PM |
|
Yep it is.
I have sorted it all out now.
Thanks to all who helped!
Trevor
|
 |
 |
Nicole
Posts: 586
|
| Posted: 02/18/2005, 3:12 AM |
|
Trevor,
when page is includable one the code used to access its controls or connections is a bit different from a code of normal pages. Namely the form’s name and connection object name should be predefined with the includable control name. By default it is the same as includable page name.
E.g. you have an includable page called Header. You added it to index page and assign to includable control name MyHeader. In this case the code on Header page should look like:
global $MyHeader;
$MyHeader->Label1->SetValue("test");
_________________
Regards,
Nicole |
 |
 |
saseow
Posts: 744
|
| Posted: 02/18/2005, 6:09 AM |
|
Thanks Nicole, Just what I needed!
Regards,
Trevor
|
 |
 |