Calling a JS function inside a Custom widget on document ready

200 views
Skip to first unread message

sowm...@gmail.com

unread,
Sep 15, 2014, 4:20:11 PM9/15/14
to suppor...@runmyprocess.com
Hi,


I am trying to invoke a method in a Custom widget from the main Webinterface on document-ready. I get the error "ReferenceError: sayHello is not defined"

More Details:
I have a customWidget(say CW1) which contains a JS widget (say JS1).
JS1 has only the following method.

function sayHello(){
alert("Hello");
}

In my webinterface(say WI1), I have included CW1 and a JS(say JS2).
JS2 is as follows.

try{
var $j = jQuery.noConflict();
$j(document).ready(function(){sayHello();});
}catch(err){
console.log(err);
}

If I have JS1 inside WI1 directly, there is no error and the alert is displayed.
Can you help me find out what the problem is?

Regards,
Sowmya

Pray Desai

unread,
Sep 15, 2014, 9:31:09 PM9/15/14
to suppor...@runmyprocess.com, sowm...@gmail.com
Hi,

In your JS2, you can add this script before you call sayHello()

id_cw.id_js1.ensureExecuted();

where id_cw is identifier defined for your included CW1 in WI1 and id_js1 is is identifier defined for your JS1 in custom widget CW1.

You can check our widgets API for javascript widget : http://docs.runmyprocess.com/API_Reference/JS#javascript-field-widget-functions

-- 
Regards,
Pray Desai,
Fujitsu RunMyProcess.


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/f2608611-62ba-418c-965c-3d49dc6c5232%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.




Message has been deleted

sowm...@gmail.com

unread,
Sep 16, 2014, 10:08:26 AM9/16/14
to suppor...@runmyprocess.com, sowm...@gmail.com
Thank you Pray!
I had tried widgetID.ensureExecuted() as mentioned in your user guide but it had not solved my issue.

Adding the JS id with the CW id solved it. Thanks for your timely response.

Regards,
Sowmya

Reply all
Reply to author
Forward
0 new messages