Atozed Forums
How to use JavaScript in IW - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: How to use JavaScript in IW (/thread-851.html)



How to use JavaScript in IW - ShaneStump - 11-30-2018

Howdy All,

I am trying to call a javascript function on a control from a C++ async event.

If the region control's name is InformationPanel, and I wish to call a method called collapse with a parameter value of 'show' or 'hide', how do I execute a command of such from C++/Dephi code:

$(InformationPanel).collapse('show');

Also, how would I register a callback on a function of the format to call a Delphi event:

$('#InformationPanel').on('hidden.bs.collapse', function ()
{
 // do something…
})

I have tried the normal callback method/register like I have for button onclick events, but this one complains in the browser's console about a syntax error on my hooking of the event.

Thanks in advance,

Shane

Howdy All!

I knew I had called the function before. For those who don't know, the solution to call the aforementioned method is as follows:

WebApplication->CallBackResponse->AddJavaScriptToExecute(L"$('#INFORMATIONPANEL').collapse('show');");

I still cannot get the


RE: How to use JavaScript in IW - Jose Nilton Pace - 11-30-2018

Hi Shane. Change only the quotation marks on your CallBack:

Code:
WebApplication->CallBackResponse->AddJavaScriptToExecute(L'$("#INFORMATIONPANEL").collapse("show");');



RE: How to use JavaScript in IW - ShaneStump - 11-30-2018

Howdy Jose!

Thanks for the reply. I didn't realize I cut my response to myself off last night but the code I wrote works! Remember I am in C Builder and C++ uses double quotes and not single quotes.

What I need to work on this morning is registering the callback events to work. Since I am well rested, that is my task after I drink a pot of strong brew!

All the best,

Shane