Does getArray('fieldname') work for you? I'm having problems getting the list of values of a group of checkboxes using . $wgRequest->getArray('fieldname'), it only returns the last element.
For instance, I have a search form with with a group of checkboxes e.g. <input type="checkbox" value="Category1" name="categories" /> <input type="checkbox" value="Category2" name="categories" />
When the form is submitted via GET, the resulting URL has: categories=Category1&categories=Category2
in my extension, I use
$category_list = array(); $category_list = $wgRequest->getArray('categories'); $categoryString = join(",", $category_list);
echo $categoryString; // Prints out 'Category2'
Any obvious error in my approach?
Thanks,
-Carlos
Michael Heyder wrote:
Brion Vibber schrieb:
Michael Heyder wrote:
Hi,
I've a litte question:
$wgRequest->getVal('_naw_title') result nothing, when post-name="_naw_title[]".
What's going wrong
WebRequest::getVal() returns a string or null. This protects against type errors from malicious submissions passing unexpected arrays.
If you're dealing explicitly with an array parameter, use $wgRequest->getArray() to enforce an array-or-null return.
-- brion vibber (brion @ wikimedia.org)
Brian,
thanks a lot.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l