Sometimes you want to search in many fields at once. For instance, you may want to look in the FirstName field and the LastName field without forcing the visitor to type the same thing into two separate form fields in the web page. Use group fields to combine several database fields into a single search.
If your database has a FirstName, LastName, and Address field that you want to look for the word "Lane" in, the URL might look like the following:
http://Results.tpl?command=search&group1field=FirstName+LastName+Address&wogroup1data=Lane
If the word "Lane" appears in any of the 3 fields FirstName, LastName or Address, then that record is considered a match.
Important: If your database fieldnames contain non-alphanumeric characters (such as the plus sign, space, comma, period, etc.) then WebDNA could have trouble distinguishing them in the list of multiple fields. In this case, you should use the alternate form for specifying groups (by adding an 's' to the end of 'GroupNField' and listing each field separately):
Group1Fields=first.name&Group1Fields=last.name |
Also: You MUST number your groups sequentially, beginning with 1. If you fail to do this, some of your group fields may be ignored. |
You can also use Group fields to search through different database fields depending on the radio button or popup a user chooses. The following HTML presents a form allowing the user to choose to search in different fields, or all fields at once.
Example 1: Allow the user to choose which field will be searched:
<form method="POST" action="Results.tpl"> <input type="hidden" name="command" value="Search"> <input type="hidden" name="db" value="catalog.txt"> <input type="radio" name="group1field" value="Description" checked>Description<br> <input type="radio" name="group1field" value="SKU" checked>Product Number<br> <input type="radio" name="group1field" value="Manufacturer" checked>Manufacturer<br> <input type="radio" name="group1field" value="Description+SKU+Manufacturer" checked>All<br> <input name="woGroup1data"> <input type="submit"> </form>
Example 2: Search two fields from a single text box:
<form method="POST" action="Results.tpl"> <input type="hidden" name="command" value="Search"> <input type="hidden" name="db" value="catalog.txt"> <input type="hidden" name="group1field" value="Description+SKU"> Type a Description or SKU:<input name="woGroup1data"> <input type="submit"> </form>
Example 3: Apply more than one comparison to a single field:
<form method="POST" action="Results.tpl"> <input type="hidden" name="command" value="Search"> <input type="hidden" name="db" value="catalog.txt"> <input type="hidden" name="group1field" value="Date"> <input type="hidden" name="group2field" value="Date"> Date:<input name="eqGroup1data"> <input type="hidden" name="grGroup2datarq" value="[date]"> <input type="submit"> </form>