[pmwiki-users] Building form with arbitrary data
5ko at 5ko.fr
Sun Oct 21 00:50:39 CDT 2012
> On Saturday, October 20, 2012 07:02:28 AM Petko Yotov wrote:
> > This page may be helpful:
> > http://www.pmwiki.org/wiki/Cookbook/InputDefault
> Thanks, I think this should help.
> 1. Also can there be support for multiple select,
> as suggested in comments on this page.
> I tried making some changes to InputToHTML function:
> $opt[$checked] = in_array(@$opt['value'],
> (array)explode(',',str_replace(' ','', $InputValues[$name])))
> ? $checked : false;
You don't need this change, just set your $InputValues as an array:
$InputValues['color'] = array('red', 'green');
> and was able to see multiple selects.
> I hope there are not more changes required for this feature.
Actually, assuming that a comma is a separator will mean that a comma can
never be part of the value. For example, you wouldn't be able to have
checkboxes like "Austin, TX", "Los Angeles, CA" and "Paris, France".
Also, as admins are already using the current implementation, the change you
suggested will break their wikis when they upgrade. We normally try to not
do this when we can.
More information about the pmwiki-users