[pmwiki-users] ZAP: markup example to retrieve stored values and pre-fill radio buttons/checkboxes ?

The Editor editor at fast.st
Thu Oct 12 04:32:03 CDT 2006


On 10/12/06, Christophe David <pmwiki at christophedavid.org> wrote:
>
> > Try the code snippet at
> http://www.fast.st/zap/pmwiki.php?n=Snippets.UpdateForms to
> see how it looks and works.
>
> Thanks a lot.  It is a lot easier with an example ;-)
>
> > When Pm redoes the Forms script (scheduled I believe for this beta run) it
> should allow you to more easily update things like radio buttons, select
> menus, and checkboxes. Right now those are rather difficult to work with.
>
> I would suggest to make the "preset" of radio buttons and checkboxes with
> stored values at a rather priority for future enhancements of ZAP : the
> "wiki based storage" is a very good idea, but updates of the data should be
> made as easy as the initial capture.
>
> With my current very limited  understanding ZAP, I can present a page where
> a user can update the text fields of his profile, but I cannot show the
> radio buttons with the stored value used as default.
>
> Would someone have a working example how to do it, or if it cannot be done
> easily, would someone have a clue as when it could be available ?  Or is it
> just too difficult to implement and one should look for another approach ?
>
> Thank you in anticipation for your help.
>
> Christophe

The problem is that the current PmWiki radio button markups do not
allow you to preset values, the same with checkboxes, textareas,
selectboxes, etc.  It's kind of a problem with PmWiki.  It is not
really a ZAP limitation.

I wrote my own Markup for selectboxes and textareas, that help and
suppose I could do the radio boxes and checkboxes also, but would have
to settle on a syntax and work out the code, which I don't have time
for just now.  Maybe someone else does?

Also, I haven't done it because Pm has said the whole forms script
will be updated soon.  In which case  my forms markup will probably be
deprecated.  Pm, any news on how long till this may be?

Actually it is possible right now if you use a bunch of conditionals,
for example with a simple checkbox you could do the following:
(Warning--these are off the cuff, and may not be exactly right, but
will give you an idea).

(:zapdata:)
(:if equal {$cb} "on":)
(:input checkbox cb checked:) Test
(:if ! equal {$cb} "on":)
(:input checkbox cb:) Test
(:if:)

For radio button it's more complex--for you have to do the same basic
lines for each button (lines 2-5 at least).  But it can be done, and
it's available now.

Let me know if I can be of any more help.

Cheers,
Caveman




More information about the pmwiki-users mailing list