[pmwiki-users] wikiforms questions (david roundell)

John Rankin john.rankin at affinity.co.nz
Wed Jul 16 18:33:36 CDT 2008

>Date: Wed, 16 Jul 2008 16:28:48 +0100
>From: david roundell <roundelld at hotmail.com>
>hellois there a way once a form has been created to dis-allow
>editing of certain fields?for example, a form is created with a
>server name, that is unlikely to change. could the editeform
>for certain fields subsequently be greyed out to stop
>accidental changes to that field, if someone then wants to
>revise that form?i'd prefer to keep the wiki open and avoid
>having to use authuser (or the like). i'm not talking malicious
>users just accidental ones!thanks againdavid

No, but...

Currently, you can prevent a field from being edited using 
the 'hide' type or by passing a value as part of the url. 
However, you can't yet say 'allow create, but not edit'.
When I use it in Wikipublisher, an author can pre-set field
values, which are then displayed with a hidden variable. 
I think I can adapt the code so a template can say, "Under
editing, prevent changes to this value." Of course, an
author can still use the regular 'Edit' link to fix errors.

I think what we can do is add a qualifier to the 'hide'
field type. If (for example) the field type is (*hide)
we can get the recipe to display a text field when
creating a new record. But I need to check to see if 
this will have any undesirable side-effects.

You can test this on your existing installation. Suppose
you have a field called 'servername'. On the page that
contains the data entry form (i.e. the (:wikiform:)
directive) add ?servername=kauri to the url in the
browser address bar, then press return. The field box
should be replaced by 'kauri'. So we just have to tweak
the code so you get a box on entry, but not on edit.

And I suppose you'd like an option to specify the size 
of the box, such as (hide=30) to hide on edit and give a
30 character box on entry.

>From: david roundell <roundelld at hotmail.com>
>Subject: [pmwiki-users] urls in wikiform fields?
>another query! can a wikiform field be 'pre-entered' with a url
>so that when the user enters data in the field and saves
>the form, the field links to documentation/url held elsewhere?
>for example i have a server that has other documentation held elsewhere. 
>%newwin%[[http://location_of_documentation?Machine=nnnnnn | nnnnnn]]
>if the user inputs nnnnnn the url picks this up to then link to that documentation/url.
>i appreciate i could perhaps pre-fill the field with the url
>but wondered if there was a user friendly way of showing this?
>or is this not handled by wikiforms?

I think the easiest way to do this is by taking advantage of
pmwiki's page text variables. See 

1. create a field for the Machine

Note that the text between the : ... : MUST NOT contain spaces.

2. create a field of type hide with value

This should tell PmWiki to use the value of the Machine in
the link text.

The alternatives are:

- create a ViewTemplate for the entire page and insert the
  <machine> field into the url (View Templates pre-date page
  text variables, so use a different substitution syntax)

- set up an intermap link for Machine: that translates
  Machine:name into http://location_of_documentation?Machine=name
  and use a text field with Machine: as the default value
  with an instruction to add the name after the prefix

If none of these works, we'll have to think of something else.

John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
john.rankin at affinity.co.nz

More information about the pmwiki-users mailing list