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.

executing filemaker script from via FM API

Featured Replies

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

  • 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();

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

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.