FoxInCloud
Problem using cScriptjsAdd
Gravatar is a globally recognized avatar based on your email address. Problem using cScriptjsAdd
  Michele
  All
  Nov 2, 2021 @ 08:19am

I have two versions of my app. One in bootstrap and another not.... In a form i use this command to show a local html file

m.oAJAX.cScriptjsAdd(Textmerge([$('<<ThisForm._pageframe1.Mappa.cntWeb.wcID>>').src='Maps/<<m.cHTML>>';]))

In bootstrap version this command doesn't work.... while in non boostrap i can see the page without problems...

Gravatar is a globally recognized avatar based on your email address. re: Problem using cScriptjsAdd
  FoxInCloud Support - Thierry N.
  Michele
  Nov 3, 2021 @ 01:51am

Ciao Michele,

The $() function exists in both PrototypeJS and jQuery, though with a different signature:

  • PrototypeJS: $() function expects an ID (string) or an HTML DOM element (object) and returns an HTML DOM element
  • jQuery: $() function expects a CSS selector (string) or an HTML DOM element (object) or a jQuery object and returns a jQuery object.

FoxInCloud started with PrototypeJS back in 2010 then, because of the numerous debates on PrototypeJS extending the HTML DOM methods and properties, and because PrototypeJS maintenance stopped in 2015, we've outphased PrototypeJS in favor of jQuery starting in 2016.

In 2017, we've added the xxxServer.lPrototypeAdd property to help you manage the transition out of PrototypeJS.

Initially defaulting to .T., xxxServer.lPrototypeAdd now defaults to .F., especially when using Bootstrap.

While the JavaScript experts used to promote jQuery everywhere, they now favour using plain 'vanilla' JavaScript and the native HTML DOM methods.

You have 2 solutions that work in both classical and Bootstrap ways:

  • replace PrototypeJS: $() function by HTML DOM function document.getElementById(); in this option you can keep xxxServer.lPrototypeAdd = .T. (but we recommend you later remove all dependency on PrototypeJS)
  • use the jQuery: $() function instead, requiring xxxServer.lPrototypeAdd = .F. with possible side effect if you have other PrototypeJS code elsewhere in your app:
    (notice the added '#' and the .attr() method)
m.oAJAX.cScriptjsAdd(Textmerge([$('#<<ThisForm._pageframe1.Mappa.cntWeb.wcID>>').attr('src', 'Maps/<<m.cHTML>>');]))
Gravatar is a globally recognized avatar based on your email address. re: Problem using cScriptjsAdd
  Michele
  FoxInCloud Support - Thierry N.
  Nov 4, 2021 @ 02:15am

Thanks. Now it works.

© 1996-2024