[pmwiki-users] How do I create a new page from form data?

Paul Bloch paul at cs.uoregon.edu
Wed Jan 29 12:52:16 CST 2014


I started by modifying the example in PmForm.DataForms.

In Site.LocalTemplates:

[[#newstudentform]]
(:input pmform target=newstudent :)
(:input default source={*$FullName} :)
(:input default request=1 :)
(:messages:)
|| First Name:||(:input text $:Firstname size=25 :) || Last Name:||(:input text $:Lastname size=25 :) ||
|| Grad:||(:input select $:Grad "" :) \
   (:input select $:Grad ms :) \
   (:input select $:Grad phd :)
(:input submit :)
(:input end:)
[[#newstudentformend]]

[[#newstudentpost]]
(:template defaults savevars=$:Firstname,$:Lastname,$:Grad :)
[[#newstudentpostend]]

In local/config.php:

$PmForm['newstudent'] = 'saveto={$FullName} form=#newstudentform fmt=#newstudentpost';

This will update pagetext variables on a page that has "(:pmform newstudent:)".  What I really want is to create a new page based on these data.  The page would be named: "GECsis.{$Today}-{$:Lastname}{$:Firstname}-Milestone".

The new page should have pagetext data from this form, plus some from a template:

(:Lastname:Dash:)
(:Firstname:Don:)
(:Grad:phd:)
(:RecordType:milestone:)
(:RecSubType:DRP:)
(:title {$:Lastname},{$:Firstname} {$:RecordType}/{$:RecSubType} :)

So specifically my questions are:

* How do I create a page named using these data?
* And save these pagetext data to the new page?
* And ideally, I need to be able to use different templates based on an input selection:
** Using "(:input select $:RecordType :), I would specify a different template for each RecordType.

Paul





More information about the pmwiki-users mailing list