February 3, 200323 yr I need to run a script immediately after a record is created from a form. I am wanting to do this using a refresh-redirect page that executes the script. So far, I have found examples of script execution from forms (buttons)and links, but I haven't seen this done using a redirect page. My best (bad) guess at the refresh code is: <META HTTP-EQUIV="refresh" content = "1;URL=FMPro?-db=NewHOSC.fp5&-format=HOSC_Success.htm-error=HOSC_Error.htm&-NAME=-Script&-VALUE="SetCalculations"&-recid=[FMP-Currentrecid]&-Find> Can someone please show me an example of this that will work? Also, if there is a better method of doing this, I'd appreciate hearing it. Thanks in advance ...
February 3, 200323 yr You might be interested in this which I posted yesterday on the Web Companion forum: "Addam notes in regards to IWP, "Many scripts won't work via the web." If you will review these forums you will find a great deal of discussion about ScriptMaker and the web. In point of fact, unless you develop a work around (one developer offered a solution and allowed it to be tested at a website now no longer there) to the issue, ScriptMaker should be avoided on the web - period. The issue is complex. First, ScriptMaker is single-threaded and does not queue multiple-event requests. Second, cdml has no way in and of itself to recognize an event failure and cannot in and of itself respond with an error page when an event fails to perform. This is true even in Pro6. If you are running ScriptMaker, you need to test it thoroughly in a multi-user/multi-event-request environment, and you need to confirm the running (or non-running) of the script event in such an environment through an examination of the database(s) in which the script runs."
February 3, 200323 yr If you need to, you could do something like this: <form action="FMPro" method="post"> <input type="hidden" name="-DB" value="mydb.fp5"> <input type="hidden" name="-Format" value="results.htm"> <input type="text" name="myfield"> . <input type="hidden" name="-Script" value="MyScript"> <input type="submit" name="-new" value="Add Record"> </form> This is from the "CDML Reference" database. Good Luck. Garry
February 3, 200323 yr Hey Philip, Garry has it right. Is there some reason that you want to trigger the script from the redirect page instead of the original submit page? If I remember correctly, the script will execute after it submits the form, not before. Or is there something special that happens on the redirect page first? Let us know. -Jeff
February 5, 200323 yr Author Thanks for the input, guys. Well, I guess there really isn't any reason to use a redirect page if the hidden script will execute immediately following record creation. I just wasn't sure how to do it. Anatoli: I knew you were going to say that . I have a form containing some questions contained in global text fields. The script sets the contents of some text fields equal to the value contained in some global text fields in order to capture the questions on a survey form (the global field text may change from time to time for the same question). There may be a better way to do this than with a script, but I don't know what it is. Any workarounds for this kind of problem? There will be a relatively small number of people using this solution at any given time.
February 5, 200323 yr You could have another Table/Database which contains the questions; rather than use Global Fields. All the best. Garry
Create an account or sign in to comment