[pmwiki-users] unsubscribe

mirceapaul at rogers.com mirceapaul at rogers.com
Thu Sep 24 12:03:42 CDT 2015


 
      From: "pmwiki-users-request at pmichaud.com" <pmwiki-users-request at pmichaud.com>
 To: pmwiki-users at pmichaud.com 
 Sent: Thursday, September 24, 2015 1:00 PM
 Subject: pmwiki-users Digest, Vol 123, Issue 15
   
Send pmwiki-users mailing list submissions to
    pmwiki-users at pmichaud.com

To subscribe or unsubscribe via the World Wide Web, visit
    http://www.pmichaud.com/mailman/listinfo/pmwiki-users
or, via email, send a message with subject or body 'help' to
    pmwiki-users-request at pmichaud.com

You can reach the person managing the list at
    pmwiki-users-owner at pmichaud.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of pmwiki-users digest..."


Today's Topics:

  1. Re: Multiple checkboxes (Petko Yotov)
  2. Re: Multiple checkboxes (Hans Bracker)


----------------------------------------------------------------------

Message: 1
Date: Wed, 23 Sep 2015 20:35:23 +0200
From: Petko Yotov <5ko at 5ko.fr>
To: PmWiki Users <pmwiki-users at pmichaud.com>
Subject: Re: [pmwiki-users] Multiple checkboxes
Message-ID: <314a1281008a73de930f81f7b4710f4b at 5ko.fr>
Content-Type: text/plain; charset=US-ASCII; format=flowed

On 2015-09-22 18:51, Hans Bracker wrote:
> multiple input box ticking results in a PTV looking something like 
> this:
> 
> Hobby: Travels,Photography,Music
> 
> which then would not populate input defaults correctly, ie. it needs
> spaces between values not commas!
> 
> How can we resolve this? I could add a Fox config variable
> "$FoxPTVArraySeparator", which could be set to a comma or a space or
> even a comma and a space or what ever. I am not sure what a change in
> the default from comma to space would break for sites updating
> fox.php.
> Could PmWiki have a similar configuration variable, so instead of a  
> space
> a comma could be used in a PTV holding array elements?

Yes, it could. The new feature was added recently and is not yet in the 
core documentation so we can change it.

Currently "space" is a separator but not so simple: one can quote 
strings containing spaces; this comes very handy from ParseArgs().

  (:input default name[] val1 "val 2" val3 val4:)
  -> note, may change!

Using a simple explode() with a separator is very easy but what happens 
if one of the values contains the separator?

Also, the current markup for all input elements:

  (:input ELEMENT name 1,2,3,4,somevalue:)

means that the "value" argument in the HTML input tag is 
"1,2,3,4,somevalue". It is not very consistent to have ONE way to define 
a value in (:input text name value:), (:input checkbox name value:) or 
any other element, and ANOTHER in (:input default name value:).

I also also think that an existing PTV in the page should be able to 
check/uncheck the checkboxes, by simply setting (:input default 
source=1:).

Let me think about it.

Petko

-- 
Change log    :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades




------------------------------

Message: 2
Date: Thu, 24 Sep 2015 11:42:51 +0100
From: Hans Bracker <design at softflow.co.uk>
To: Petko Yotov <5ko at 5ko.fr>
Cc: PmWiki Users <pmwiki-users at pmichaud.com>
Subject: Re: [pmwiki-users] Multiple checkboxes
Message-ID: <100685613.20150924114251 at softflow.co.uk>
Content-Type: text/plain; charset=us-ascii


> Using a simple explode() with a separator is very easy but what happens
> if one of the values contains the separator?

> Also, the current markup for all input elements:

>    (:input ELEMENT name 1,2,3,4,somevalue:)

> means that the "value" argument in the HTML input tag is 
> "1,2,3,4,somevalue". It is not very consistent to have ONE way to define
> a value in (:input text name value:), (:input checkbox name value:) or
> any other element, and ANOTHER in (:input default name value:).

I agree. I also think it may be too much to push the array concept
too far when we want to save arrays in simple PTVs.
Since the space separator works well enough with (:input default:),
as illustrated with your example, it may be best to leave it at that.

I will publish a fox.php version, which will use space as separatot
when saving array values in a PTV, by default. And have an optional
$FoxPTVArraySeparator variable, which can be set to "," or other
separator character strings.

I also found a way to have checkboxes reflect the values in such a
PTV, by using a simple markup expression to clean up the PTV for use
with spaces in (:input default .. :), like in this form example:

(:foxmessages:)
(:fox frm ptvtarget=Main.WikiSandbox ptvfmt=text :)
(:input default $:Hobby[] {(foxcleanptv "{$:Hobby}")} :)
(:input hidden $:Hobby " ":)
(:input checkbox $:Hobby[] Travels:) Travels
(:input checkbox $:Hobby[] Photo:) Photography
(:input checkbox $:Hobby[] Music:) Music
(:input submit post:)
(:foxend frm:)

The markup expression defined in config.php:

$MarkupExpr['foxcleanptv'] = 'FoxCleanPTV($args[0])';
function FoxCleanPTV($arg) {
        global $FoxPTVArraySeparator;
        $pat = '/'.$FoxPTVArraySeparator.'/';
        return preg_replace($pat," ",$arg);
}

This seems to work well with various separators, and the PTV can look
for instance like these, in simple text PTVs:

Hobby: Travels,Photo,Music
Hobby: Travels, Photo, Music
Hobby: Travels + Photo + Music


Best regards,
 Hans                        
mailto:design at softflow.co.uk
www.softflow.co.uk




------------------------------

Subject: Digest Footer

_______________________________________________
pmwiki-users mailing list
pmwiki-users at pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


------------------------------

End of pmwiki-users Digest, Vol 123, Issue 15
*********************************************


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20150924/ed11f7d7/attachment.html>


More information about the pmwiki-users mailing list