Jump to content

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


This topic is 2770 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 2770 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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