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.

Featured Replies

Does anyone know of any books or anyplace on the internet that would show of any examples of how javaScript and CDML work together??

What I'm trying to do is this:

I'm building a real-time sign-in system to where when a student checks into the tutoring center it counts the time that student was with a tutor and after 20 minutes it turns their last name red to show that their time is up.

I've tried a timing script in FM. It worked, but it resets every time the sign-in program refreshes itself (every 5 seconds). Also it didn't work well with other scripts. It was a HUGE waste of computer resources.

I know I need a JavaScript Clock (which I have courtesy of JavaScriptKit.com). Has anyone does this or could give guidance as to the right direction?? Thanks!

Scripts and Web is not happy marriage. Especially the long one!

You do not have to combine JS and CDML.

Just use another color for the name changed by JS clock.

Do you mean that when a student 'signs-in' that page on the browser remain open. Or, is the 'sign-in' time logged to the database and the 20mins is 'watched' from there?

If you keep the 'signed-in' page on the browser JS can keep track of the time and change a colour when the time is up. It could even write a 'flag' back to the database.

All the best.

Garry

  • Author

Hi Garry

quote:

Do you mean that when a student 'signs-in' that page on the browser remain open?


Yes. The browser remains open and on the same page that refreshes itself every 5 seconds with the status of all the other students that have signed in.

quote:

Or, is the 'sign-in' time logged to the database and the 20mins is 'watched' from there?


This happens as well. I have a seperate calculation that simply subtracts the end time from the start time after the end time is logged in. My problem is how to get the text to turn red after 20 minuets to let people know that their tutoring session is up. It has to be done in Javascript because a timing script in FM is not possible. Especially due to the fact that we have many students signed in at once and the script couldn't handle that plus being refreshed every 5 seconds due to the web page refresh. Thanks for your insight!

Edward,

The Javascript function to look at, is 'setTimeout()', it uses milliseconds. It will be able to call a function to change the colour of a style-sheet object.

Later today I may have a chance to write an example.

All the best.

Garry

  • Author

Thank you very much for pointing me in the right direction. I'm going to go pick up a JavaScript book tonight as well. Thanks!

IMHO 5 seconds refresh is way too fast. If you have 10 visitors it will amount to 2 transaction per second. Depending on HW and complexity of query it may overload your FM server.

  • Author

Hi Anatoli,

I will only have a max amount of visitors of 6 at any one time. Not all six visitors will be on all at the same time simultaneously (well it's only happened once). I've been concerned about the databse being overloaded by requests too...that's why I was going to run it and see what happens before I implement it just to make sure.

Create an account or sign in to comment

Important Information

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

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.