ZAP Form Processor

(redirected from Cookbook.ZAPdata)

Summary: The ZAP forms processor handles data and file management, page insertions (forums, blogs), email & newsletters, e-commerce, and more.
Status: Stable (relies on latest Beta version of PmWiki)
Maintainer: (unsupported since 2008)
Discussion: ZAP-Talk

ZAP's Documentation and Support Website

For more extensive information, demos and support about ZAP:
http://zapdoc.web-farm.org (2012-09-14 down, and no knowledge of who the webmaster is/was!)

zap-20181207.phpΔ, and zaptoolbox-20181207.phpΔ are modified 2007-05-31 version files patched that resolve “Warning: preg_replace(): The /e modifier is no longer supported” issues (tested on pmwiki-2.2.110).

What can this recipe do?

Basically, ZAP extends the forms script that comes standard with PmWiki by adding a (:zapform:) and (:zapend:) markup to create forms that act in special ways controlled by standard input fields: text, textarea, select, radio, checkbox, etc. As of 2007, ZAP added an optional zap input field which uses session variables for more secure data transfer. ZAP and ZAPtoolbox also offers a few additional markups, markup expressions, page variables, conditionals etc. ZAP stores data invisibly on wiki pages (visible when you edit), and makes it retrievable as standard PmWiki text variables for easy use in pagelists and searching.

To install, simply download zap and if desired the zap toolbox, and enable as needed in local config files. For the documentation, download the zapdocs.zip file, dump into wiki.d, and goto Support.HomePage. Please direct all questions/comments to the PmWiki mailing list.

KAL: I've created a file zapdocsnew.zip, where the groups of the ZAP pages are changed to ZAP* (i.e. added a Suffix ZAP to all groupnames) and the references are (hopefully all) changed accordingly. See also pmwiki maillist, mails to ZAp-support in Aug 2007.

Sample ZAP forms

To create a very basic ZAP form, just sandwich standard text boxes, password boxes, radio buttons, checkboxes, whatever between the (:zapform:) and (:zapend:) markups. The ZAP forms processing engine will be called, and depending on the field names and values, various actions triggered. Here is how to set up a simple form that saves data:

(:messages:)
(:zapform:)
(:input text "Field1":)
(:input text "Field2":)
(:input hidden savedata "Field1,Field2":)
(:input submit value="Zap it!":)
(:zapend:)

If you want to look at the data, just edit the data page. You will notice them stored as text variables in the standard hidden format. To retrieve the data, use the normal syntax. In the above example, just put the following somewhere on the same page:

Field 1: {$:Field1}
Field 2: {$:Field2}

On another page you can write {Group.Name$:Field} to retrieve these values. To update a form field, simply prepopulate it with existing data and then resave with the changes. Fields not list will not be changed. Here is an example combining lines from the two samples above:

(:messages:)
(:zapdata:)
(:zapform:)
(:input text "Field1" {$:Field1}:)
(:input text "Field2" {$:Field2}:)
(:input hidden savedata "Field1,Field2":)
(:input submit value="Zap it!":)
(:zapend:)
Data:
Field 1: {$:Field1}
Field 2: {$:Field2}

ZAP Features

The ZAP Forms Processor has many built in features, and is easy to extend. Throw in PmWiki's fantastic flexibility and you end up being able to do about anything you want with a form--including some rather complex and powerful applications. Below is a partial list of actions you can trigger in a ZAP form. (Most require the ZAPtoolbox). For more information plus code snippets illustrating ZAP at work, see the documentation download.

  • New Member Registration
  • Member Login
  • Group Management
  • Form Validation (pattern matching)
  • Password Protect Forms
  • Field Replacements
  • Forward Browser to Any Page
  • Save Data on Any Page
  • Get Full URL's for Pages
  • Random Number Generator and Captcha
  • Time & Time Formatting
  • Messaging System
  • Pass Data via Get Variables
  • Save Data/Erase Data
  • Hide Data from Text Variables
  • Advanced List Management
  • Find and Replace
  • Create Pages (templated from form data)
  • Delete Pages
  • Upload Files in a ZAP Form
  • Email to Addresses, Members, or Newslists
  • Shopping Cart & Order Forms
  • Payment Processing through PayPal
  • Post Submission Conditional Processing
  • Basic Math and PHP
  • Instant Messaging
  • Self grading quizzes and even courses
  • Many new ZAP markups and custom conditions
  • Edit pages or sections of pages
  • Page insertions
  • Powerful Logging (sort, trim, etc)
  • And probably more!

ZAP Security

Combining form submissions with the kind of power available in ZAP calls for strict security measures. In addition to automatically disabling PmWiki directives, and other malicious php code in form submissions, ZAP has several built in security measures--including tough forged header protection, and an internal security system controlling all toolbox commands. ZAP also sets up its own permissions level within PmWiki allowing you to limit who can submit forms to specific users, groups, or passwords, and even have different permissions on different groups and/or pages.

At present there are NO known security vulnerabilities. However, no software is perfectly safe. See the ZAP support site for a full discussion of ZAP's security features.

Contributors

  • Caveman Click here to learn more about the story behind this recipe...
  • Many others who have suggested countless ideas along the way.

Comments

See discussion at ZAP-Talk