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.

Pass Web Viewer Variable Back To Script

Featured Replies

Hi all

I have a web viewer in a FMP database layout.  All is functioning fine in the web viewer.  Inside the web viewer I have a variable which is just a string of text.  I can get this variable to print on screen in the web viewer so I am sure it is performing properly.

However, I would like to now take this variable and its value and pass it back to FMP for use in a search script.

I have fiddled around with the FMP URL, but I can not make it work.

Currently, the variable name is "msg" and the url I am attempting to use looks like this:

<a href="FMP://$/MyFMPdatabase/script=isolatesearch&param=msg&value=$msg">

The error it throws is this:

"The file MYFMPdatabase/script=isolatesearch&param=msg&value=$msg.fmp12 could not be opened.  Either the host is not available, or the file is not available on that host."

Not sure why it's appending .fmp12 to the value either.

Any suggestions on how I might accomplish this would be greatly appreciated.

Thanks.

Please post a link that points to a description of how to use the FMP URL.

When posting the link, look it over carefully to see how it differs from what you have done.

It looks like you are using '/' after your database name when it should be a '?'

Also param should just =$msg

So your URL would be:

 
<a href="FMP://$/MyFMPdatabase?script=isolatesearch&param=$msg">
 
https://www.filemaker.com/help/14/fmp/en/html/sharing_data.17.6.html

Edited by Sky Willmott

  • Author

It looks like you are using '/' after your database name when it should be a '?'

Also param should just =$msg

So your URL would be:

 
<a href="FMP://$/MyFMPdatabase?script=isolatesearch&param=$msg">
 
 
Hi Sky,  Thanks for the helpful advice.
Even with your syntax, I am still getting an error, albeit a bit different.  The error now says simply:
"The file MyFMPDB could not be opened.
Either the host is not available, or the file is not available
on that host."
 
Also, this example from the link you sent should work, but it isn't.
 

  • Author

It looks like you are using '/' after your database name when it should be a '?'

Also param should just =$msg

So your URL would be:

 
<a href="FMP://$/MyFMPdatabase?script=isolatesearch&param=$msg">
 
https://www.filemaker.com/help/14/fmp/en/html/sharing_data.17.6.html

Thanks Sky.  I've got it.  Using your example I found that my DB name was the issue.  My DB name was MyFMPdb-V3.4.  It didn't like either the hyphen or the DOT.  Once I renamed my DB, I can now get it to go to the DB and start the script.

Thanks for all your help.  My last step will now be figuring out how to get the variable (msg) on my web viewer to be picked up in the URL so I can set it to a field in the layout.

Thanks again. 

Also param should just =$msg

So your URL would be:

 
<a href="FMP://$/MyFMPdatabase?script=isolatesearch&param=$msg">

I'm not sure that's what kdefilip is going for. The goal, as I understand it, is not to pass the literal text "$msg" (tasty as that sounds!) to the script, but the value from a JavaScript variable in the Web Viewer. That could be done either as a parameter:

fmp://$/databaseName?script=isolatesearch&param=<contents of JavaScript variable>

Or that could be done by launching the script with the $message variable already set with the desired value:

fmp://$/databaseName?script=isolatesearch&$message=<contents of JavaScript variable>

  • Author

I'm getting to the point that kdefilip doesn't know what kdefilip wants any more.

Basically this is my problem:

<div><a href=FMP://$/MyFMPdb?script=isolatemarkers&param=\"msg\">Isolate</a></div> <!--This returns "msg" literal txt to the script -->
<div id=\"msg\"></div>  <!-- This prints the actual contents of the variable msg to the page, as it should -->>

Basically, no variation of the above FMP URL returns anything but literal text OR nothing at all, and at this point I have tried hundreds of variations.  At this point, it appears that what I am trying to do is just not possible.

Examples:

<div><a href=FMP://$/MyFMPdb?script=isolatemarkers&param=msg>Isolate</a></div> <!--This returns msg literal txt to the script -->

<div><a href=FMP://$/MyFMPdb?script=isolatemarkers&param=param=\"+msg+\">Isolate</a></div><!--This returns +msg+ literal txt to the script ->

It looks like you're not getting the contents of the JavaScript msg variable into the URL. This is the mess that is HTML+CSS+JavaScript. It might be easier to generate the whole URL and open it leaning more heavily on JavaScript than HTML. Look at the example for the third answer on this Stack Overflow question, and see if that helps.

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.