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.

Migrating from IWP to WebDirect...How to call script with javascript

Featured Replies

  • Newbies

Everyone,

 

I am working on migrating from filemaker server 12 with IWP. I currently use it on some iPods through safari. 

I am able to call a javascript function that correlates to a button on the layout to process a barcode scan. 

 

Example of that code:

 

function iwpExecute(){

  CancelEventPropagation.call();

  top.iwp.executebuttonscript(176,'recnumField','recnumField');

  }

 

The 176 references a number assigned to the button on the layout. 

 

Calling this function in a webviewer worked perfectly for 5 years now. 

 

 

Moving on:

 

Filemaker 15 Webdirect doesn't have a clear cut way of processing a script from javascript.

I tried the http://wwww.example.com/fmi/webd#MyDB?script=Test

This doesn't always take and it will frequently ask for a username and password over and over again.

Which end users would hate.

 

I would like to trigger the button with a javascript function to proceed processing. 

But Webdirect uses a ton of eventlisteners, but the one that gets triggered is an anonymous function with random letters and values in a return function. I tried .click() events, mousedown, mouseup, click simulations on the button( ref by element id) BUT NOTHING WORKS.

 

Any advice on making a script in Webdirect run via javascript or otherwise but in a clean worry free manner?

 

Thanks All!

The best way I've found to trigger a script to run on the client is to send a CWP request back to the server with the Persistent ID of the WebDirect client. From there, you can do the old "perform script on client" trick by deleting a record in a virtual window on the WebD session to get a script trigger to fire. From there, you are off to the races and can run whatever script you want.

Takes a bit of setup, but works great in WebDirect. Trick is to open a new window and get to a "session" record, then bring another window to the front so that window is something the user never sees, but will still trigger a script onRecordLoad if the record gets deleted.

Hope this helps
Mike

  • Author
  • Newbies

Can you further elaborate on: "send a CWP request back to the server with the Persistent ID of the WebDirect client" and

also on " old "perform script on client" trick by deleting a record in a virtual window on the WebD session"? 

Thanks for the help.

 

  • Author
  • Newbies

I figured out a solution. Thanks!

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.