· Jun 1

Calling clientmethod or method from HTM component

Hi guys,

How can call a clientMethod, Method or classMethod from a html component?

I've this hyperlink acting as a button in  a zen page and onclick I've tried the below which is actually executing the function but failing to call the classMethod line, and is there a way to just call clientMethod instead of javascript ? 


   <td><id="btnLast" data-role="button" onclick="getWOs();" href="MyOrders.WO.cls">Last </a></td>

ClassMethod retGetWO(wo)
Set (WO,Note,Desc,out)=""
if MtcId'=""
&SQL(Select  Wo into :WO From Purchace.Order Where id=:wo)
WO'="" %session.Data("WO")=WO }

function getWOs()
var wo=document.getElementById("WOs4").value
sessionStorage.setItem("sWO", wo);





Product version: Ensemble 2018.1
Discussion (6)1
Log in or sign up to continue

Principal limit: HTML just knows about JavaScript
JavaScript is executing an XHTML call to your Ensemble carrying along all required credentials.
e.g. sessionid,  encryption, cookies, ....
In your namespace SAMPLES zipcode.cls ia a detailed example,
your call looks like this;


But the generated code is this:


HTML has no idea about all this


Thanks Robert but :

  1. I check Samples & User namespaces in Ensemble 2014 to 2018 and couldn't find zipcode.cls or similar class 
  2. I've check the online docs and find some code but all of them using the old CSP pages and it's working fine in my CSP pages as well but not working in the new Zen pages where its using the Method & ClassMethod call as in my code above not the old eg.
<script language="cache" method="AlertUser">
&js<alert("Hello User");> 

in CSP pages and my understanding it should be the same for some reason its not working? 
I've some tracing code and actually it's failing at 
#server(..retGetWO(wo))#; line, its not recognizing the syntax which makes me thinks that's only work in CSP pages!? 


Sorry: my typo:   zipcode.csp  generates  csp.zipcode.CLS

<script language="cache" method="AlertUser">  
this generates the method.
But your CSP page works with HTML + js in your Browser
to the Browser that interprets and call just as JS.

BTW: old CSP pages
YES, this hasn't changed since it was fresh ~22 years ago (my 1st training docu @ISC)
and NO browser ever accepted ObjectScript as scripting language.
the <script language="cache"  ...> tag is just a compiler directive and never reaches  the browser.