Hi Ranjith, Milinda , Danusha, After big effort did this using ajax calls. Thanks for your touching explanation and guidance. Have a nice evening guys… Regards, Akila
From: Rajith Vitharana [mailto:[email protected]] Sent: Friday, August 01, 2014 2:17 PM To: Milinda Perera Cc: Akila Nimantha [IT/EKO/LOITS]; [email protected] Subject: Re: [Dev] calling a jaggery function using button onclick Hi Akila, AFAIK this is not how it is done. As you have written the code "startTask" function is in server side so you can't invoke it as normal javascript function which reside in client side. So either you have to do a ajax call to the server and invoke the jaggery method or put this method to client side and invoke as normal javascript function. Since you are doing a WS request inside this function, I think you'll have to keep this function in server side and do a ajax call to invoke the method. You can find more on [1] [1] - http://jaggeryjs.org/documentation.jag?api=ws Thanks, On Fri, Aug 1, 2014 at 12:57 PM, Milinda Perera <[email protected]<mailto:[email protected]>> wrote: Hi Akila, Try this one: print('<button onclick="startTask(' +id +' )">Start</button>') Or you can put like this outside the scripting segment (<%%>) <button onclick="startTask(<%=id%>)">Start</button> Thanks, Milinda On Fri, Aug 1, 2014 at 12:36 PM, Akila Nimantha [IT/EKO/LOITS] <[email protected]<mailto:[email protected]>> wrote: Hi all, Im in a little trouble calling a jaggery function through html button “onclick” event. When I click on the button my browser firebug console says , “ReferenceError: startTask is not defined”. What I did was, <% Var id = 8605; Print(‘<button onclick="startTask(id)">Start</button>’); var startTask = function (id){ var version = new ws.WSRequest(); var options = new Array(); options.useSOAP = 1.2; options.action = "urn : start"; var cookie=session.get('cookie'); options["HTTPHeaders"] = [ { name : "Cookie", value :cookie }, ]; var payload = '<ns:start><ns:identifier>'+id+'</ns:identifier></ns:start>'; var result; var endpoint= "https://192.168.255.150:9443/services/HumanTaskClientAPIAdmin/"; try { //response.addHeader('Cookie', cookie); version.open(options,endpoint, false); version.send(payload); result = version.responseXML; print('<script>alert('+result+');</script>'); } catch (e) { log.error(e.toString()); //session.put("showLogin", "true"); print(e); //return null; } }; %> Are there wrongs in my code…? Regards, Akila This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and (i) destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication. Thank you. _______________________________________________ Dev mailing list [email protected]<mailto:[email protected]> http://wso2.org/cgi-bin/mailman/listinfo/dev -- Milinda Perera Software Engineer; WSO2 Inc. http://wso2.com , Mobile: (+94) 714 115 032<tel:%28%2B94%29%20714%20115%20032> _______________________________________________ Dev mailing list [email protected]<mailto:[email protected]> http://wso2.org/cgi-bin/mailman/listinfo/dev -- Rajith Vitharana Software Engineer, WSO2 Inc. : wso2.com<http://wso2.com/> Mobile : +94715883223 Blog : http://lankavitharana.blogspot.com/ This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and (i) destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication. Thank you.
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
