How can I get the caption name of the table on client side

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sagmag
User
Posts: 182

How can I get the caption name of the table on client side

Post by sagmag »

I am on the add page and would like via javascript to get the table caption for that add page. How can I do it?

And is there any documentation which describe all the classes of Phpmaker with their methods, Static Variables .... both for the server side and client side? This because it seems that there are a lot of good features already develop but the help file doesn't describe all the classes and static variables.


Webmaster
User
Posts: 9427

Post by Webmaster »

You can pass server side value to client side in Page_Load event of the Add page, e.g.

ew_SetClientVar("myCaption", $this->TableCaption());

Then you can get it on the client side by ewVar.myCaption.

Read "Server Events and Client Scripts" -> "Some Global Functions" in the help file, see the source code in phpgn.php and ewshared.php for info of the classes.


sagmag
User
Posts: 182

Post by sagmag »

wonderfull


sangnandar
User
Posts: 980

Post by sangnandar »

Webmaster wrote:
You can pass server side value to client side in Page_Load event of the Add page,
e.g.

ew_SetClientVar("myCaption", $this->TableCaption());

I put the code in Global->All Pages->Page_Loading() with a minor tweak:

ew_SetClientVar("myCaption", CurrentPage()->TableCaption()); // this will applied for all pages.

This works fine EXCEPT for custom files, since custom files doesn't have TableCaption().
So I have to refine the code into this:

if (NOT custom files) ew_SetClientVar("myCaption", CurrentPage()->TableCaption());

But I have no idea how to define (NOT custom files).
Please help.

Thanks.


sangnandar
User
Posts: 980

Post by sangnandar »

Solved.

if (CurrentPage()->PageID != "custom")
ew_SetClientVar("myCaption", CurrentPage()->TableCaption());


mobhar
User
Posts: 11702

Post by mobhar »

Or you may simply use this (assume "Include common files" option is enabled in your Custom Files):

if (CurrentPageID() != "custom")
ew_SetClientVar("myCaption", CurrentPage()->TableCaption());


Post Reply