Link difference with form and document

I’ve created a form that I use on the web. In the HEAD section of this form I’ve added the following line: “<script type="text/javascript" src="MenuBar.js">” to load some JavaScript (ManuBar.js is a JavaScript library). This works flawlessly as it should, when I open the form in a browser.Then I saved a document with that form, and tried to open the document on the web. After I did that, the JS failed to load. So did the images on the document. I then tried to add a …/ in front of the links, like this “<script type="text/javascript" src="…/MenuBar.js">” and then is suddently started to work for the document. But if I open the form now (with …/ in front of the links it fails to load the JS).

The way I see it, is if there is no …/ in front of the resources I try to load, it works for forms but not for documents. If I add a …/ in front of the resources, it works for documents, but not for forms. Can anyone explain this behavior?

Regards,

Hans

Subject: The difference is between Creating a new doc and editing an existing doc.

When you Create a new Doc, your Realm is the Database, so “MenuBar.js” is evaluated relative to the database. When you are editing an existing document, the Realm is now the Document, so you need the “…/” prefix to get back to the database level. The way we do this is to insert some computed text: with this formula: @If(@IsNewDoc; “”; “…/”)“<script type="text/javascript" src="MenuBar.js">”

Subject: Thanks! It makes sence…

I had one of those famous ‘Ahaa…’ experiences. Thanks for opening my eyes!

Regards,

Hans