[pmwiki-users] WikiForm - wikilist searching (Peter & Melodye Bowers)
John Rankin
john.rankin at affinity.co.nz
Thu Oct 25 17:24:48 CDT 2007
On Thursday, 25 October 2007 7:49 PM, Peter & Melodye Bowers <pbowers at pobox.com> wrote:
>It does appear to be an issue of case. When I put in your echo statement it
>had converted my variable names to lowercase and nothing worked. When I
>changed variable names to lowercase I can now select.
>
>Problem solved.
Excellent. I have also uploaded a new version which adds
(:wikilist field==value:)
support for exact matches. If I did it correctly:
(:wikilist type=book:)
returns book and booklet, whereas:
(:wikilist type==book:)
should just return book. I *think* with your version you can write
(:wikilist type=book,!booklet:)
but exact matching is obviously better (unless one makes a typo)
>
>3 other issues arose in the process which aren't urgent, but may need to be
>addressed at some point:
>
>(1) Variable names need a little more flexibility. I had already noticed
>(and put in a feature request on the wiki) that underscores in a variable
>name cause that field to be ignored. Now the problem with uppercase shows
>in the selection. An intentional definition of the syntax of a variable
>name should be made and then applied throughout. "[A-Za-z_][A-Za-z0-9_]*"
>is pretty standard in other languages although I'm not familiar with php...
>(Hyphens might be nice too?)
For what started as a quick-and-dirty system to solve a local problem,
this recipe seems to have taken on a life of its own. Yes I'll look
into making it more generous towards different variable naming schemes.
I also needed to decide what to do if the template designer omits a
variable name -- shifting the prompt text to lower case and removing
spaces seemed like a reasonable thing to do.
>
>(2) This may be by design but I don't really catch the motivation... In the
>data page the data is stored prefixed by the *prompt* rather than the
>variable name. In other words I get ":Please enter the author:Smith, John"
>in the page 00001 instead of ":author:Smith, John". Again, there may be
>some very good reason for this, but it seems to me like prompts will change
>far more often but variable names should theoretically stay much more static
>and so the data should be attached to the variable name and not the prompt.
>That way I can fix the hypothetical typo in my prompt without having to go
>through and re-edit each and every data-page to get it fixed. (Also it
>seems like it would speed up selection slightly if you didn't have to go
>through a mapping process of prompt->variablename in the (:wikilist
>name=value:) selection.)
The ViewTemplate is a relatively new feature (I am still finding minor
bugs in it), so for a long time all you saw was :term:definition markup.
It seemed to me that using the prompt in the page gave more reader-
friendly results. You see the same thing on the page and on the form.
The code tolerates changes to prompt text; if you change it, everything
still works, but some pages show the old prompt. It is not tolerant to
changes in variable name. In your example I'd use this template entry:
:Author:author Please enter the author ("Surname, First Name")
The "Please enter the author" becomes a tool tip and the field is
pre-filled with the format. Of course, there are many ways to do it.
>
>(3) I went through and edited the data-pages with ?action=edit instead of
>?action=editeform, thinking that would make things faster. It was faster
>editing, but somehow I was suddenly unable to get *ANY* results from
>(:wikilist:). I went back and edited them with the form and it fixed the
>problem. I then went back and intentionally made a change in the prompt for
>the (title) variable in the datapage and suddenly my ViewTemplate couldn't
>find anything. I went back to the (:wikilist:) page where it was selecting
>on that field and it found nothing. I guess this makes sense based on #2
>above -- if there's not an exact correspondence between the prompt in the
>FormTemplate and the datafile then it would be impossible to do a match.
>But I do think both the loss of ViewTemplate when the title variable is
>changed as well as the selection not responding when the prompt changes are
>both evidences for the difficulties raised by the issue in #2.
I am quite surprised at this. Both the list and the view use the element
name, not the prompt text. The only thing I can think of which might
cause this is if there is a space here:
:Prompt text: variablename
^
What happens when you mouse over the prompt? Do you see variablename
in the tool-tip? If so, it may be using prompttext as its variable
name, not variablename. You can tell by viewing the html source of
an entry form page -- that will show the names of all the form
variables used.
And using the regular edit should not cause things to break -- wikiforms
uses PmWiki's edit function to post the form data. However, if that
space is there above, that might cause things to go awry.
I may need to ask you to tar and gzip your wiki.d directory and send it
to me so I can try to get to the bottom of this one with real data.
<snip>
Hope this helps
JR
--
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz
More information about the pmwiki-users
mailing list