[FX.php List] [FMP-IF: CurrentAction.eq.delete]
Chris Hansen
chris at iViking.org
Sat Apr 8 10:55:04 MDT 2006
Tom,
Yes, there is an easier way. Take advantage of the fact that a
button is only passed to the processing form. So, assuming that you
have multiple actions being processed on a single page, you might
have something like this:
$myQuery = new FX(FM_IP, FM_PORT, FM_TYPE);
$myQuery->SetDBData('Database_Name', 'Database_Lauyout');
$myQuery->SetDBUserPass(FM_UN, FM_PW);
if (isset($_POST['editButton'])) {
$myQuery->SetRecordID($_POST['tempRecord']);
$myQuery->AddDBParam('Field1', $_POST['formField1']);
$myQuery->AddDBParam('Field2', $_POST['formField2']);
$myData = $myQuery->DoFXAction(FX_ACTION_EDIT);
} elseif (isset($_POST['deleteButton'])) {
$myQuery->SetRecordID($_POST['tempRecord']);
$myData = $myQuery->DoFXAction(FX_ACTION_DELETE);
}
Make sense? This way you can actually have the database information
set once (above the conditionals) and only have the portions of code
that are distinct within the conditional's branches. Some notes:
1) I've used syntax for the individual actions that appeared in
FX.php v4.0, however the FMFind(), FMEdit(), etc. methods would work
just the same.
2) The code above assumes that you have inputs something like this
associated with the record:
<input type="hidden" name="tempRecord" value="2">
<input type="text" name="formField1 " value="Field 1 Data">
<input type="text" name="formField2" value="Field 2 Data">
<input type="submit" name="deleteButton" value="Delete">
<input type="submit" name="editButton" value="Edit">
3) Of course the above could be expanded with logic for additional
actions.
<shameless_self_plug>
The curriculum that I created for the PHP class that I teach for The
Moyer Group goes into this and other areas in much greater detail.
For more information, go here:
http://www.moyergroup.com/pages/cwp.php
</shameless_self_plug>
HTH
Chris Hansen
Application Developer
The Moyer Group
chansen at moyergroup.com
http://www.moyergroup.com/
-
Creator of FX.php
"The best way from FileMaker to the Web."
http://www.iViking.org/
-
FileMaker 7 Certified Developer
On Apr 7, 2006, at 4:46 PM, Thomas Myers wrote:
> Am converting a CDML program and I have the body of a frame based
> page referring to "[FMP-IF: CurrentAction.eq.delete]".
>
> Any ideas on how to reproduce this in FX. The only way I can think
> of is to set my own session global each time I do a call...
>
> Am I missing an easier way?
>
> Thanks
>
> Tom
>
> --
> Thomas Myers - ITA,Inc.
> (585)889-9119
> 5 Wood Sorrel mailto:tmyers at itainc.com
> Rochester, NY 14624 http://www.itainc.com
>
> C/C++, Photoshop Plug-Ins, Filemaker, Filemaker Plug-ins, Visual
> Basic, Real Basic, SCSI, Firewire, USB, Applescript, XML,
> Filemaker, TWAIN, Quicktime, Mac/Win cross platform solutions.
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list