All Collections
Landing Pages & Co Reg
Landing Pages - For Developers
Change date with menus year values using data-to and data-from attributes
Change date with menus year values using data-to and data-from attributes
Korey Abbott avatar
Written by Korey Abbott
Updated over a week ago

By default, the Databowl data with menus year select field shows the current year and 100 years to select from. This would show 2023 down to 1923.

If you would like to amend the year values that are displayed, then this article explains how you can adjust this with custom attributes in the date with menus field template.

The below template has been changed slightly to show -18 years from the current year (data-from). This is useful if you only want to gather leads that are 18 years old and over.

2023 - 18 = 2005

and to a specific year (data-to)

2023 - 65 = 1958

An example of how to add 10 years to the dropdown would be to change -65 to -75 in the data-to attribute

<div class="date-menus">
<select name="{{field_id}}" data-as="day" data-handler="date-menus">
<option value="" disabled selected data-db-localized-content="{{field_id}}_DAY_PLACEHOLDER"></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
<select name="{{field_id}}" data-as="month" data-handler="date-menus">
<option value="" disabled selected data-db-localized-content="{{field_id}}_MONTH_PLACEHOLDER"></option>
<option value="01" data-db-localized-content="MONTH_01_NAME_FULL"></option>
<option value="02" data-db-localized-content="MONTH_02_NAME_FULL"></option>
<option value="03" data-db-localized-content="MONTH_03_NAME_FULL"></option>
<option value="04" data-db-localized-content="MONTH_04_NAME_FULL"></option>
<option value="05" data-db-localized-content="MONTH_05_NAME_FULL"></option>
<option value="06" data-db-localized-content="MONTH_06_NAME_FULL"></option>
<option value="07" data-db-localized-content="MONTH_07_NAME_FULL"></option>
<option value="08" data-db-localized-content="MONTH_08_NAME_FULL"></option>
<option value="09" data-db-localized-content="MONTH_09_NAME_FULL"></option>
<option value="10" data-db-localized-content="MONTH_10_NAME_FULL"></option>
<option value="11" data-db-localized-content="MONTH_11_NAME_FULL"></option>
<option value="12" data-db-localized-content="MONTH_12_NAME_FULL"></option>
</select>
<select name="{{field_id}}" data-as="year" data-handler="date-menus" data-from="-18" data-to="-65">
<option value="" disabled selected data-db-localized-content="{{field_id}}_YEAR_PLACEHOLDER"></option>
</select>
</div>

πŸš€ Need More assistance?

If you're stuck or if this isn't something you or your team is comfortable with, then please open a new chat/ticket (chat icon in the bottom right of the screen) or email support@databowl.com.

We're here to assist with any questions you have, and if required we can quote on actioning work like this for as part of our Marketing Services.

Did this answer your question?