Skip to content

Modifying the output of hmpoDate #155

@wilsond-gds

Description

@wilsond-gds

I’m trying to figure out if it’s possible to override or add attributes output by a call to hmpoDate, which we are using to create 3 part date entry fields. Currently the output is something like:

<input class="govuk-input govuk-date-input__input govuk-input--width-2" 
id="dateOfBirth-day" 
name="dateOfBirth-day" 
type="text" pattern="[0-9]*" inputmode="numeric" 
maxlength="2">

as part of asking for a date of birth – would it be possible to add a custom autocomplete field for each of the 3 inputs, and override the maxlength attribute, as I have experienced issues with using Voice Control adding spaces when I'm filling in a number, meaning a double digit number is sometimes transcribed as a single digit.

Ideally, it would be good to know how to write a hmpoDate call that would produce the following code:

<input class="govuk-input govuk-date-input__input govuk-input--width-2" 
id="dateOfBirth-day" 
name="dateOfBirth-day" 
type="text" pattern="[0-9]*" inputmode="numeric" 
maxlength="4" 
autocomplete="bday-day">

and so on for the three date fields. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions