Back
daySelectTag()
Builds and returns a string containing a select
form control for the days of the week based on the supplied name. This version works without binding to a model object.
Example 1: Basic usage
#daySelectTag(name="dayOfWeek", selected=params.dayOfWeek)#
Generates a standard select dropdown for all days of the week.
Pre-selects the value from params.dayOfWeek if available.
---
Example 2: Include a blank option
#daySelectTag(name="meetingDay", selected=params.meetingDay, includeBlank=true)#
Adds a blank option at the top so users can select nothing.
---
Example 3: Custom label before the field
#daySelectTag(
name="deliveryDay",
selected=params.deliveryDay,
label="Choose delivery day:",
labelPlacement="before"
)#
Adds a label that appears before the dropdown.
---
Example 4: Prepend and append HTML
#daySelectTag(
name="eventDay",
prepend="<div class='select-wrapper'>",
append="</div>"
)#
Wraps the dropdown inside a <div> for styling purposes.
Copied!