[pmwiki-users] pmwiki forms

Hans design5 at softflow.co.uk
Tue Jul 8 04:58:33 CDT 2008


Tuesday, July 8, 2008, 2:57:22 AM, Maria McKinley wrote:

> Does anything happen when one hits submit as (:input submit
> value=Submit:) on a form? Or is it just sort of a dummy button until
> you add a recipe to deal with it?

It depends if the form activates a script. This is specified in the
first of the forms directives. For instance like

(:input form "ScriptUrl":)

the from submission will run pmwiki.php. That is usually followed by

(:input hidden action somewikiaction:)
(:input hidden n {$pagename}:)

Both the wiki action and pagename are used by pmwiki.php as parameters.

So using Pmwiki/Forms markup does not necessarily need a script for
processing the input data, as pmwiki can do a fair amount too!
But if you want data added to a page etc. you need another script
to do the processing and saving.

A form processing script like fox.php or pmforms.php has its own
markup directive to replace the (:input form "ScriptUrl":)
directive. This is just for convenience. It will still call
pmwiki.php, but with its own custom wikiaction and parameters.


> I know there are several form cookbooks out there, but it wasn't clear
> to me how they relate to forms.

Hope what I wrote above makes it clearer!


> Is there one that just collects the
> data after submit is pushed and saves it somewhere for me? As far as
> user interface goes, Forms is fine for me, and I don't care about
> added security, it will be in a secure part of my site. I don't want
> Fox, though, as I am using the old fox for my blog, and the new fox
> doesn't have the features I want yet.

Obviously fox.php is built to do just that, and it is unfortunate
that you are stuck with an older version, because I never got around
to upgrade the blog templates for the newer fox.
Still your older version should be just fine to add content to a page
etc. But the foxnotify.php extension is dependent on the new fox.php
version, I think.

For adding content to some page you just need to specify the target
page and a template, which uses replacement variables {$$varname},
where 'varname' would be an input form field name. So whatever data
in an input field gets submitted is been added as content on the
target page at the placement of {$$varname} in the template.
An example:

(:fox form1 target=SomePage:)
(:foxtemplate "* Stuff to be added: {$name1}":)
(:input text name1 :)
(:input submit post:)
(:foxend form1:)

For more complex templates use a template page and call it with
template=TemplatePage in the (:fox form1 ...:)  markup, instead of using
(:foxtemplate ".........":)

Add more input fields as needed, use any of the types outlined on
PmWiki/Forms.

All this should work fine with the fox.php you got installed.
If you got problems or need to know more about form construction,
please ask!


  ~Hans




More information about the pmwiki-users mailing list