Tutorial: Allowing Multiple Option Selections
|
Example:
|
Profile Manager Premium supports multiple options for selection boxes. However, the Database Wizard will not create these kind of form fields automatically. You should first create a regular drop down menu database field. Then follow the tutorial below to make it an multiple option field.
The example discussed in this tutorial is a database field called "seeking". Members can seek one or more of these answers:
Here is how to do it:
1. Go to Admin -> Preferences -> Database
2. Add this line to "Fields including multiple data"
|
"seeking" => 6, |
3. Add this into the registration form:
|
<select name="seeking" multiple size="6"> <option>Man</option> <option>Woman</option> <option>Couples</option> <option>Groups</option> <option>Friends</option> <option>PenPal</option> </select> |
4. Add this into the modification form:
|
<select name="seeking" multiple size="6"> <option %%SELECTED:seeking:Man%%>Man</option> <option %%SELECTED:seeking:Woman%%>Woman</option> <option %%SELECTED:seeking:Couples%%>Couples</option> <option %%SELECTED:seeking:Groups%%>Groups</option> <option %%SELECTED:seeking:Friends%%>Friends</option> <option %%SELECTED:seeking:PenPals%%>PenPals</option> </select> |
%%SELECTED:field:value%% simply prints "selected" if there is a "value" text inside "field" database field. Same way, there is also a CHECKED function for checkboxes.
5. Add this into the profile template:
|
seeking: %%SEPERATE:seeking:, %% |
%%SEPERATE:field:delimiter%% simply prints "field" database field, and if there is more than one value for it, it seperates the values with "delimeted" text.
6. Add this new field to search using "in_field", "if_field" will not work for multiselection fields. So it would look like this in search:
|
<select name="in_seeking"> <option>Man</option> <option>Woman</option> <option>Couples</option> <option>Groups</option> <option>Friends</option> <option>Penpal</option> </select> |





