Jump to content
Server Maintenance This Week. ×

executing filemaker script from via FM API


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

Recommended Posts

  • Newbies

I’m hosting on FMS 10 (not advanced) and running FMP 11 Advanced on my desktop. I’m using the Filemaker ‘Registration’ template as a basis for the project. I’ve made the necessary customizations to the template to for their needs. Now I’m using the Site Assistant generated code to build a web interface to the database. The end users can now come in and either create a new account or edit their existing account fields. The next step is to allow them to register for new events once they have verified their account information.

The flow looks like this (depending upon new record or existing record)

home -> addrecord.php -> browserecord.php -> eventrecordlist.php

Or

->findrecords.php->recordlist.php->editrecord.php->browserecord.php -> eventrecordlist.php

Eventrecordlist.php returns a page listing all of the available events with a registration button for each that the user should be able to click and execute the second of the scripts listed below.

Within the template there are two filemaker scripts that do exactly what I want

1) Register the current Contact for an Event

2) Register the current Contact for an Event 2 (which makes calls to 2 more scripts)

Create New Registration

Go to Contact Form Layout

I’ve removed any non-web usable commands and tested this within the template and everything works perfectly.

The issue I’m facing is that I can’t get these scripts to execute properly from the webpage. Based on some advice found at http://www.hierarchy.lv/?p=192 I’ve created a page that sits between browserecord.php and evenrecordlist.php called script_pre.php that is designed to execute the first script. The code is below. The first problem seems to be that the $recid gets dropped somewhere between executing the script and the code within the html. I’m not sure what I’m doing wrong and would greatly appreciate some advice.

(CODE FOR script_pre.php)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<?php

/**

* FileMaker PHP Site Assistant Generated File

*/

require_once 'fmview.php';

require_once 'FileMaker.php';

require_once 'error.php';

$cgi = new CGI();

$cgi->storeFile();

$databaseName = 'CTE Registration';

$layoutName = 'Select List - Events';

$scriptName = 'Register the Current Contact for an Event';

$userName = $cgi->get('userName');

$passWord = $cgi->get('passWord');

$fm = & new FileMaker();

$fm->setProperty('database', $databaseName);

$fm->setProperty('username', $userName);

$fm->setProperty('password', $passWord);

$record = NULL;

$recid = $cgi->get('$RecordID');

//sample code from http://www.hierarchy.lv/?p=192 to execute script from buttons on http://161.45.157.13/registration/eventrecordlist.php

$script =& $fm->newPerformScriptCommand($layoutName,$scriptName);

@$result = $script->execute();

// end of sample code from http://www.hierarchy.lv/?p=192

ExitOnError($fm);

$layout = $fm->getLayout($layoutName);

ExitOnError($layout);

?>

<html>

<head>

<meta http-equiv="refresh" content="0; url='<?php echo "eventrecordlist.php?-action=browse&amp;-recid=$recid";?>'

<link rel="stylesheet" type="text/css" media="screen" href="oceani.css">

</head>

<body>

</body>

</html>

Link to comment
Share on other sites

  • 3 weeks later...

Ya same problem with me also. I also not able to fire the script within PHP code after insert the record.

As PHP code is same as in standard.

Coding is as:

$layout_name='Reg';

$script_name = 'insertFile';

$script_param = '';

$script_object = & $fm->newPerformScriptCommand($layout_name, $script_name, $script_param);

@$script_result = $script_object->execute();

Link to comment
Share on other sites

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