Page 1 of 1

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

Posted: Sat Jul 29, 2017 4:37 pm
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.


Re: How can I get the caption name of the table on client si

Posted: Sat Jul 29, 2017 5:02 pm
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.


Re: How can I get the caption name of the table on client si

Posted: Thu Aug 03, 2017 1:38 am
by sagmag

wonderfull


Re: How can I get the caption name of the table on client si

Posted: Sat Oct 21, 2017 12:02 am
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.


Re: How can I get the caption name of the table on client si

Posted: Sat Oct 21, 2017 2:59 am
by sangnandar

Solved.

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


Re: How can I get the caption name of the table on client si

Posted: Mon Oct 23, 2017 8:49 pm
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());