[pmwiki-users] zap cancel button

noskule noskule at gmx.net
Fri May 18 10:11:58 CDT 2007


The Editor schrieb:
> On 5/17/07, noskule <noskule at gmx.net> wrote:
>> hi dan
>> Is there a way/example for a cancel button? The cancel button should not
>> touch the datapage but use "nextpage"  to return to the basepage.
>>
>> grz nos
> 
> 
> Not really, but you might be able to get that effect if you did
> something like the following (not tested)
> 
> (:zap if="equal 'button' 'Cancel' ? warn='action canceled' ":)
> (:zap warn='':)
> 
> ... rest of form
> 
> (:input submit button value='Do Action':)
> (:input submit button value='Cancel':)

oky I did this. See:
http://netstreams.org/test/pmwiki/index.php/Zap/CancelTest
pwd is quick.

The cancel button works, but I cant get it working that the if statement
recognizes the "Submit" button as submit button.

Do you have any idea what's wrong?



> 
> The idea is the first thing the form checks is which button you push.
> If Cancel, you give warn an message which will cause the form to
> abort. Otherwise, warn (if = '') is ignored, allowing the form to be
> processed.
> 
> A cancel button would be nice, but ZAP processes all form inputs in
> the order they appear, so unless you put it at the top of your form,
> it wouldn't do much good.
> 
> Cheers,
> Dan
> 
> PS. Not to say it couldn't be done... A special check for the abort
> value before any other form processing might be all it takes...
> Hmmm...
> 

I think the way above is just perfect. The reason is, that if one would
like to cancel, that don't mean, the form should not take any action.
For example: I submit the datapage and nextpage via get to the form. If
I would like to cancel I still want to the "nextpage". So your solution
above gives the flexibly it needs.
grz nos



More information about the pmwiki-users mailing list