[pmwiki-users] Fwd: validating ZAP pagenames & (:pagelist:) problem?

The Editor editor at fast.st
Thu Mar 8 04:23:52 CST 2007


On 3/8/07, SteP <step.list+pmwiki at gmail.com> wrote:
> Hi Dan,
>
> > Here's the code at zapsite to give you an idea how zap's conditional's
> > work:
> >
> > http://www.fast.st/zap/pmwiki.php?n=Snippets.Create
>
> Yes, that's where I started from originally. You can break it by entering
> a group name, "Files.a b c" results in:
>
>     Form submitted. Page Files.Files.a b c has been created.

Ah ok.  You'll notice if you enter a b c it will tell you Invalid Page
Format, so it is kind of working, just not catching every possible
invalid page name....

The pagefmt conditional is supposed to be "smart" enough to pass
either a page Name format or a Group.Name format.  But it shouldn't
accept Files.a b c. I tried changing the form to this, but it still
doesn't work:

(:messages:)
(:zapform name=files:)

||Create: ||(:input text makepage:)
|| ||(:input submit:)
(:zap if1="pagefmt Files.{makepage}||create|Files.{makepage}" files:)
(:zap if2="! pagefmt Files.{makepage}||warn|Invalid page format" files:)
(:zap warn="" files:)
(:zap create="" files:)
(:zapend:)

 Why this passes is beyond me.  I'll have to try and debug the
conditional test some more later today... Very strange...Thanks for
pointing this out.

Cheers,
Dan

PS.  In the meantime, if you can do expression matching, you might
tinker with the validate option also.  If I remember right, it looks
something like this:

(:zap validatemakepage="/pattern/||warn|Invalid page format" files:)

Of course the pattern must only accept an initial capital letter, no
spaces or strange characters, etc.  Unfortunately you can not do two
validation tests on one field, but if you go ahead and set create to
Files.{makepage}, the one validation test should trigger warn to stop
processing before the page is created.

Will get back with you if I can find the bug.



More information about the pmwiki-users mailing list