Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Saving javascript in global field

Featured Replies

Hey and good morning from Europe!

 

I have a problem saving javascript in global field. When I quit Filemaker, changes goes away and reverts back to old one. Is there a workaround for this?

 

 

This raises question for other people who needs to run the javascript? 

 

We are using Filemaker 13.0v3 & Filemaker Server 2013

 

 

Would one solution be to save it as normal field and make a script to update the global field which triggers when user need's the script?

 

Or is there a better solution for this?

 

Thank you for all the help I can get!

In a hosted solution, a client can modify global fields only for the duration of the session. After that, they revert to the values entered the last time the file was opened in single-user mode.

 

 

Is there a workaround for this?

 

I am sure there is - but it would be useful to know how this javascript is being generated/modified and what is it used for. If, for example, it is used by a web viewer, why don't you keep it in inside the web viewer's setup?

It sounds like you are sharing your database.  According to the FM Pro help manual, changes made to a global field are only saved if changes are made on the host computer.  

  • Author

Thank you for your reply. 

 

For now, I don't want to put it in web viewer because I'm developing the JavaScript code. I think it removes the formatting of the code, when I copy the source code from the web viewer. (Hmm, tested to add line break ¶, and it worked).  But still it's lot easier and cleaner when having the code in a field. 

 

I'm using d3js library and making custom JavaScript file for week overview of workers workload. It's pivot table(cross table) which I figured is easier and more cleaner to make with JavaScript than create with Filemaker.

 

Matthew:

Oh, I see, so it would work if I copy the database as local and deleted it from server. And when I'm finish editing a just upload back to the server.

 I don't want to put it in web viewer because I'm developing the JavaScript code.
 
My own preference would be to put the Javascript in an external text file while still working on it (and use a text editor for this work), and point the web viewer to this file. When you are done, you can store the finished script in the web viewer (and keep the text file in case further modifications are needed).
 
 
 
In this context it might be useful to know:
Quote ( Textfield )
will escape your code, making it ready to include in a calculated HTML.
 
Evaluate ( Textfield )
will reverse the process.
  • Author

Ok, thx will try that.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.