[Version 2] Create an advanced search form
This article builds on the Fields and Forms article which helps you build basic custom forms in Raisely. Start there if you’re looking to get a grounding in how Raisely themes handle forms.
Using Fields in Search Forms
The default search form in Raisely is editable in Themes > Templates under the Search heading. Each theme provides a simple search input to allow users to search profiles by name:
<field type="text" model="form" field="q" label="Name"></field>
This can be extended with the field directive to let your users search based on a custom field. In this example, adding a text field lets us match profiles whose public custom field , “city” matches the typed value:
<field type="text" model="form" field="public.city" label="Participant's City" placeholder="Enter a city name"></field>
And like every other form, we can use any field type to provide a different input format for the search. In this example, profiles can be search by a public field called “event”. We’re using the options attribute to limit the options the user can use to limit the search. Passing in the final blank value with the “Any Event” option means the field is passed through without a value, so all profiles are returned:
<field type="select" model="form" field="public.event" label="Event"value="" options="[{value:'sydney',label:'Sydney Fun Run'},{value:'newyork',label:'New York Fun Run'},{value:'',label:'Any Event'}]"></field>