Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Multiple values in the same form variable



******    message to minivend-users from Mike Heins <mikeh@minivend.com>     ******

Quoting Christopher Thompson (ct@arborinternet.com):
> 
> I always forget this one, and since I was just working on some related
> code I thought I would contribute a little code snippet that people might
> use.
> 
> For coordinated searches or for checkbox inputs, multiple values are
> placed in the same form variable. The values are separated by Nulls
> (that's the thing I always forget). Here is some code to convert to a
> comma separated string for use in [loop] tags, etc. This is not optimized
> Perl, but I wanted it to be understandable.
> 
> [perl values]
> @array = split (/\0/, $Safe{'values'}{'mv_searchspec'});
> $str = join (",", @array);
> return $str;
> [/perl]
> 

In most later MV versions, including 3.14, the easy thing is
just to say:

  [value-extended name=mv_searchspec joiner=","]

Or to do the same thing as above in MV4:

 [calc]
 @array = split (/\0/, $Values->{mv_searchspec});
 $str = join (",", @array);
 return $str;
 [/calc]

-- 
Internet Robotics, 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <mikeh@minivend.com>

Light travels faster than sound. This is why some people appear bright
until you hear them speak. -- unknown
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: