[pmwiki-users] ZAPdata savedata question

The Editor editor at fast.st
Sun Nov 19 03:20:29 CST 2006


On 11/19/06, William Cole <eric at wanderinglighthouse.com> wrote:
> Hi,
> I'm using the code below to process multiple buttons on a form.
> Different templates are loaded into the form depending on the button
> clicked, using the (:include:) directive.  While the (:if ... :)
> conditionals and the (:include:) directive are working to give me the
> results I would expect, the (:input hidden savedata ......:) within
> the body of the (:if :)body(:ifend:), is not.
>
> What I'm running into is that the (:input hidden savedata ......:)
> saves the data whether or not the condition of the (:if :)body
> (:ifend:), where it resides, is met.
>
> Any tips, comments or pointers?
>
> Thanks,
> Eric
>
>
> =============
>
> (:zapdata:)
> (:zapget:)
> (:zapform:)
>
> (:if equal {$MyAction} "View" :)
> (:include Forms.ContactView:)
> (:ifend:)
>
> (:if equal {$MyAction} "Update" :)
> (:include Forms.ContactUpdate:)
> (:input hidden savedata "Field1,Field2,Field3,FieldTextArea":)
> (:ifend:)
>
> (:input hidden button "View" :)
> (:input submit button "View":)
> (:input submit button "Update":)
>
> (:input hidden MyAction "{button}":)
> (:input hidden passdata MyAction:)
> (:input hidden nextpage:)
>
> (:zapend:)
> ==============


Yeah, this is a great use of the code.  Glad to see you taking
advantage of some of the more creative things you can do with ZAP.  To
be honest, I'm not sure why it's not working, but I can give you some
suggestions that may help.

Actually write out the complete forms in the conditional, and don't
use includes.  I have some pages which do three, or four different
things based on the passdata values.  It may be the problem is in the
included files (which I can't see).  If there's an (:if:) for example
in the included forms it would cause what you're describing.  It's
also easier to debug and make changes.

See the "Profiles" snippet for a just slightly more complicated
example of how to do something exactly like this.

Also a couple minor things, you don't need the (:input hidden
nextpage:) line, unless you are redirecting to another page.  It's
automatically supplied.  And I don't have a clue what the "hidden"
button line is for:  (:input hidden button "View" :).  Maybe it's a
typo and can just be deleted.  It might even (unlikely) be causing you
problems.

Hope this helps.  If not, send me the included files (or your updated
attempt to fix it) and I'll look and see if I can't suggest something
else.

Cheers,
Caveman




More information about the pmwiki-users mailing list