Custom Search Form for ListViewer

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 27, 2008   (RSS)

Re: [Dawna] Custom Search Form for ListViewer

By Dave - February 27, 2008

Sure, there's no automatic way to do that but it's possible with some PHP code. Try this:

<select name="category">
<?php
$tablename = $options['tableName'];
$fieldname = 'yourFieldName';
$schema = loadSchema($tablename);
$fieldSchema = $schema[$fieldname];
$fieldOptions = getListOptionsFromSchema($fieldSchema);

foreach ($fieldOptions as $valueAndLabel) {
list($value, $label) = $valueAndLabel;
$encodedValue = htmlspecialchars($value);
$encodedLabel = htmlspecialchars($label);
print "<option value='$encodedValue'>$encodedLabel</option>\n";
}
?>
</select>


Just page that where you want your dropdown list and change the fieldname to match yours and it should work.

For more details, have a look at this thread:
http://www.interactivetools.com/iforum/P59787

Let me know if you have any trouble with that.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Custom Search Form for ListViewer

By Dawna - February 27, 2008

Rock 'n Roll! You're awesome.[/#ff0080]