[pmwiki-users] Adding Title field to Edit Form

Waylan Limberg waylan at gmail.com
Mon Oct 3 13:08:48 CDT 2005


I've seen this mentioned on the list a few time before, but have not
seen how it is done exactly. I want to add a Title field to the edit
form so the users can type a Title in there rather than use the
(:title Some Tile Here:) markup. I have a Group of over 100 pages
where the URL and pagename would be way too long if the entire title
was used, so I've added $Titlespaced to the template and want an easy
way to remind the users they need to enter a title. The markup way
would be to confusing for this group of users. A input field in the
form is really best.

So far, I tried this in config.php:

SDVA($InputTags{'e_title'], array(
   ':html' => "<input type='text' \$InputFormArgs />",
   'name' => 'title', 'value' => $Title));

Then in Site.Editform I added:

$[Title]: (:input e_title:)\\

And I get a blank input field in the edit form. Upon viewing source, I see this:

<input type='text' name='title' />

If you notice, no value is defined. I realize that, according to
http://www.pmwiki.org/wiki/PmWiki/MarkupVariables the $Title variable
may not be available here, but I don't see an equivalant listed here:
http://www.pmwiki.org/wiki/PmWiki/Variables.

So I guess my first question is: How can I get the current title to
display as the default value? Is there a variable for this or will I
need to add some code to create it?

Secondly, I'm not sure where to start to make PmWiki save that value
rather than one defined by the (:title.. markup.

I did find this from a previous thread:

> Keep in mind that once you turn something into a field of its own
> that is stored outside of the markup, PmWiki no longer keeps track of
> older versions of the values in the page history (unless you start
> adding code to do that).  It can be done, but it's not automatic.
>
> My suggestion for this would be to continue to store the field values
> in the markup, but make edit form directives that are smart enough to
> extract the values from the markup when an edit page is requested, and
> replace any of the directives with the revised values from the form
> when a page is being saved.  (I don't know if this would be easy or hard
> to do -- that's just the way I would go about it.)

I understand all that, and will look into the possabilities, but I
guess I'm not sure where to start here. I just want to make it work
without that extra stuff first, then look into that. Any pointers
would be helpful.

Although, on second thought, if it's being stripted out of the markup
before being displayed in the edit textarea and then added back in
before saving, I suppose that answers both my questions. But, then
again, it this worth the effort?

--
----
Waylan Limberg
waylan at gmail.com




More information about the pmwiki-users mailing list