InputDefault-Talk

Summary: Talk page for InputDefault.
Maintainer: Petko
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

I would like to propose an update, not a big one, but I think useful: the possibility to write the title-attribute (tooltip) in the elements of the input form, e.g.:

(: input select name=... title=”...” value=... label=...:)

Frank August 26, at 2:30 PM

Thanks, yes, this is an attribute that I'd certainly use, now added for 2.2.103. --Petko August 29, 2017, at 05:45 AM

Thank you. Frank August 29, at 2:15 PM


This is a great start! But there needs to be a way to specify multiple values for groups of checkboxes and select-multiple drop-down menus. Suggested syntax:

 (:input default favorites PmWiki,PHP,Apache:)

Ben Stallings January 22, 2007, at 09:25 AM


It is necessary to put the default form before the non-default form entries it refers to.

BenoitDutilleul? April 2, 2007, at 23:54 AM


It is also necessary to put a line break after the default tag.

Ben Stallings June 09, 2007, at 05:49 PM


Q: How to set a default from a PTV beeing on the same page?
I use the ZAP-formprocessor to make an input select:

My script:

(:zapform:)
||Summary:  ||(:input text "Summary" '{$:Summary}':)||
||Category: ||(:input select Category "Instruction":) (:input select Category "Information":) ||
(:input submit value="Save":)
(:input hidden savedata "Summary,Category":)
(:zapend:)

Summary: {$Summary}
Category: {$:Category}

So far it works. I'm able to set the values, they are stored on the same page. And when I open the page again the value "Summary" will be preset to what I typed in.
But how can I preset the input select Category to "Information"? The "default source=" works only if the variable comes from a different page.

Thanks

Andreas September, 10 2010

Can you reproduce the problem without using ZAP and re-post the form source so we can try to figure it out without having to install/learn zap?

For instance, this source here works using the current page as the source for the defaults (note how I've named the fields):

(:input form:)
(:input default source={$FullName}:)
||Summary:  ||(:input text "Summary" '{$:Summary}':)||
||Category: ||(:input select $:Category "Instruction":) (:input select $:Category "Information":) ||

Summary:something I wrote
Category:Instruction

I'm not sure how that would work with ZAP, but that's how you default from PTVs in pmwiki forms...

Peter Bowers September 10, 2010, at 06:23 AM

Hi Peter,

without ZAP and if I set the PTVs in front of the input form it works!

Summary:{$:Summary}

Category:Information

(:input form:)
(:input default source={$FullName}:)
||Summary:  ||(:input text $:Summary {$:Summary}:)||
||Category: ||(:input select $:Category "Instruction":) (:input select $:Category "Information":)||

But if I set the PTVs invisible (:Category:Information:) or I set them behind the input form it don't work.... And, by the way, how do I set PTVs without using ZAP?

Andreas - September, 13 2010

Please refer to Test.InputDefault2 where I have taken your form, changed the way you define your text field (removing the value {$:Summary} there), added a $:ThirdPTV to the form, defined $:Summary and $:Category as hidden PTVs *before* the form and $:ThirdPTV as hidden PTV *after* the form.

Reading a PTV value is absolutely agnostic in terms of (a) what format it is defined with (hidden, definition, etc.) and (b) where the PTV is defined in the text.

ZAP is a recipe that apparently has a lot of power and still apparently has a small but loyal user base. However, it is rarely (if ever) updated and questions referring to ZAP are not generally answered promptly, if at all. I would hesitate to say it has been abandoned or is unsupported, but it definitely appears to be moving that way. There are other form processors out there such as Fox, PmForm, and WikiSh. All of these will receive much more prompt answers and I believe all can handle creating PTVs from a form. (I'm not certain re PmForm because I've never gotten over the lack of documentation and so I've never used it.) Probably fox is what you are looking for.

I am leaving this discussion here on this page so you will find it, but it has gotten too long and involved for a main documentation page. Perhaps you could move it to InputDefault-Talk and we can continue there.

Peter Bowers September 13, 2010, at 08:22 AM


Setting input defaults for checkbox arrays

Checkbox arrays are useful, yet I recently had a few issues setting input defaults.
Adding "checked" at the end of any input field, paired with a conditional, appears to solve the matter.
An hidden input at the top takes care of the case when no checkbox is checked.
Here is a working example using the matchstring conditional and Fox:

(:fox testform ptvtarget={$FullName} ptvclear=1:)
(:input hidden Hobby "":)
(:input checkbox Hobby[] Reading (:if matchstring '/Reading/' "{$:Hobby}":)checked(:ifend:):) Reading
(:input checkbox Hobby[] Climbing (:if matchstring '/Climbing/' "{$:Hobby}":)checked(:ifend:):) Climbing
(:input checkbox Hobby[] Music (:if matchstring '/Music/' "{$:Hobby}":)checked(:ifend:):) Music
(:input checkbox Hobby[] Sleeping (:if matchstring '/Sleeping/' "{$:Hobby}":)checked(:ifend:):) Sleeping
(:input checkbox Hobby[] Chess (:if matchstring '/Chess/' "{$:Hobby}":)checked(:ifend:):) Chess
(:input checkbox Hobby[] Gardening (:if matchstring '/Gardening/' "{$:Hobby}":)checked(:ifend:):) Gardening
(:input submit post enter:)
(:foxend form:)
Hobby:Sleeping

Luigi 27 Dec. 2014

Talk page for the InputDefault recipe (users?).