 |

Dawna
Novice
Feb 27, 2008, 3:51 PM
Post #1 of 3
(349 views)
Shortcut
|
|
Custom Search Form for ListViewer
|
Can't Post
|
|
I am using a code similar to this on one of my ListViewer pages and it works great but we will need to provide the pre-defined list of catogories to run the search. Can you provide the code that allows me to include a pre-defined drop down box for the search? <form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>"> Categories: <input type="text" name="category" value="" size="15"> <input type="submit" name="" value="Search"> </form>
|
|
|  |
 |

Dave
Staff
/ Moderator

Feb 27, 2008, 5:42 PM
Post #2 of 3
(346 views)
Shortcut
|
|
Re: [Dawna] Custom Search Form for ListViewer
[In reply to]
|
Can't Post
|
|
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
|
|
|  |
 |

Dawna
Novice
Feb 27, 2008, 7:49 PM
Post #3 of 3
(345 views)
Shortcut
|
|
Re: [Dave] Custom Search Form for ListViewer
[In reply to]
|
Can't Post
|
|
Rock 'n Roll! You're awesome.
|
|
|  |
|