[pmwiki-devel] Question about Forms & Actions

Ben Stallings Ben at InterdependentWeb.com
Mon Dec 11 12:47:20 CST 2006

The Editor wrote:
> Do I have the gist of all this?

Yep, you've got it!

> To make it configurable, how about setting a SDV value for
> ZAPformaction = to "action=$ScriptUrl?n=$pagename" and then insert
> this into the form markup.  This way, an admin could overwrite it if
> desired in a local config file?

Handier would be for the (:zapform:) markup to allow the destination of 
the form to be specified within the wiki markup.  For example,
  (:zapform http://example.com/example.cgi:)
would produce
  (:input form action=http://example.com/example.cgi method=post:)
  (:input hidden action zap:)
and so on.

> Let me know if I'm more or less on track and I'll try and work out the
> code, (or you could supply it to make sure it works for what you
> need).

I'll see if I can get that to you this afternoon.

> PS.  Could you explain why you are using ZAP in an edit field?
> Interesting, but no clue why you are using it this way...  Quite
> curious!

Because PmWiki has an edit action already, and it seems to me that if a 
person is viewing a record (or data page) and clicks edit, the 
user-friendly thing to do at that point is to let them edit the record 
(or data page).  :-)

UpdateForm works much as ZAPdata currently does: you put a form on a 
single page, and to view a record you view the *form page* (not the data 
page) with some variable=value in the URL.  But the way DataQuery works 
is that you view the *record* as if it were a wiki page, with Table.Id 
as the page name, and you edit it just as if it were a wiki page, except 
that the form you use to do the editing has separate fields for each 
field of data instead of one big text-editing field.

The same trick works with ZAP data pages: if you have a ZAP form in the 
$Group.EditForm, then you can edit a data page by clicking the edit link 
just as you would any wiki page.  The only trick is to tell PmWiki to 
use the $Group.EditForm if one exists, instead of $SiteGroup.EditForm. 
I don't have the line of code on me at the moment, but I'll send it to 
you shortly.  Maybe it could be a snippet on ZapSite.  :-)  --Ben S.

More information about the pmwiki-devel mailing list