Jump to content

Pass Web Viewer Variable Back To Script


kdefilip

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

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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.
 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 3125 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.