[pmwiki-users] thoughts on PTVs, (:include:) and editing forms

Patrick R. Michaud pmichaud at pobox.com
Tue Nov 13 12:27:36 CST 2007


On Tue, Nov 13, 2007 at 04:38:50PM +0000, Hans wrote:
> Tuesday, November 13, 2007, 3:50:57 PM, Patrick R. Michaud wrote:
> 
> > Works fine for me -- I think you omitted the equals sign on the 
> > source= option to (:input defaults:).
> 
> yes you are absolutely right. - And it works!
> 
> It took some trials to get the variables right in the form.
> And to discover that you introduced a ptv_PTVNAME input name to take
> the value from name=$:PTVNAME.

What really happens is that forms.php internally converts
name=$:XYZ to be 'ptv_XYZ', if only because I'm not sure
that a string like '$:XYZ' is a valid control name.

On the forms handling end (e.g., in PmForms), the ptv_XYZ
controls are converted back into the '$:XYZ' format.

> So part of the form looks like this:
> {$EditTarget} is full name of target page,
> {$EditSection} is the targeted ptv name,
> both get past along from the edit link embedded in the target page,
> via the link markup.
> 
> (:input hidden {$EditSection} {$$ptv_{$EditSection}} :)
> (:input defaults source={$EditTarget} :)
> (:input textarea id=text name=$:{$EditSection}  cols=50 rows=6 :)
> 
> 
> The section anchor pattern works half:
> I can grab the section apparently, edit it, save it, but the section
> end anchor is gone, swallowed somewhere along the line.
> Maybe the pattern needs tweaking?

The pattern is designed to work with PageTextVars() -- i.e.,
the "variable name" portions of the markup and other syntax aren't 
considered to be part of the value.  

For example, just as

   (:XYZ:
   something
   :)

has "something" as its value and doesn't include the closing ':)', then

   [[#XYZ]]
   something
   [[#XYZend]]

has "something" as its value and doesn't include the closing '[[#XYZend]'.

Pm



More information about the pmwiki-users mailing list