FoxInCloud
Including a .js file
Gravatar is a globally recognized avatar based on your email address. Including a .js file
  Paul
  All
  Jun 9, 2019 @ 11:28pm

Hi,

I want to add a .js file only for one form, so I did this in form.wcHTMLGen :
toHTMLgen.cHTMLAdd = [ <script type="text/javascript" src="/awScripts/wearml_engine.js"></script> ] && 4TFIC

It appeared in the .htm file for the form, but that did not exist in the HTML in the browser!

I have now added the HTML by doing this :

protected function wFormStandardPage_cMetaTagsAdd && {en} additional meta tags for your standard page - 4TFIC  
  
local lcHTML  
lcHTML = [ <script type="text/javascript" src="/awScripts/wearml_engine.js"></script> ]  
return m.lcHTML  
encfunc  

This works and the HTML appears in the in the browser - for all forms.

What should I do if I only want it included in a particular form?

Thanks
Paul

Gravatar is a globally recognized avatar based on your email address. re: Including a .js file
  FoxInCloud Support - Thierry N.
  Paul
  Jun 10, 2019 @ 02:45am

see aw\awServer.prg!awProcess.cawJSinc() and aw\samples\fic\ficTuto\tutoServer.prg!tutoProcess.cawJSinc()

So far FoxInCloud can't execute a JavaScript file from within an AJAX response; so you can only do add the custom JavaScript when building the master page where your specific form may display (either as master form or child form).

If the form requiring the JS can be a child of almost any master form, you need to load/execute the JS file on all pages; otherwise you can load it based on the master form's name.

© 1996-2019