FileMaker Webviewer + PHP: Passing field value to PHP POST through browser?
I am trying to manipulate the Web Viewer in File开发者_如何转开发Maker so that I can pass a part model number to a web page so that the Web Viewer loads with search results for whatever part I'm looking at. I was able to do this easily with Google and eBay, as they accept search queries through the address bar - all I had to do was run a calculation on the Web Viewer's input field to return, say, "http://www.google.com" + [part number field]. However, one of the websites that we need to do this with submits searches via POST (as far as I can tell).
Any idea as to how this might be done?
Have the web viewer calculate its URL something like this:
data:text/html,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Submit Form</title>
</head>
<body onload="document.forms['my_form'].submit()">
<form action="http://www.search-engine.com/target-page.php" method="post" id="my_form">
<input name="part_number" type="hidden" value="39845" />
</form>
</body>
</html>
What this does is hard-code in a form with the required fields, submitting to the search engine. The neat trick is the little bit of javascript triggered on page load that promptly submits the form.
(Also note the use of the data:text/html header that allows you to specify the content of the web viewer page, rather than fetching that content from server.)
Check out ScriptMaster, which allows the execution of Groovy (a Java derivative as far as I understand it) code within FileMaker. The plugin is free and the included FileMaker file has a function called "Post Data To URL" that should already do the job. It will allow you to "register" that function as an external function when the file is launched so that you can call PostDataToURL( key; value; url )
from any FileMaker calculation.
精彩评论