Knockout-Contrib / Knockout-Contrib/Knockout-Validation

When specifying the maxlength of a field, add attribute maxLength to the element

Open
#200 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1k
Forks
366
PR merge metrics
No merged PRs in 30d

Description

How would i do this in Knockout validation? When specifying the maxLength of a input through the validation, it will properly validate, but I think it'd be a good idea to add the maxLength attribute to the HTML element itself, which would prevent (in realtime) the user from ever going over the maxLength. (http://www.w3.org/TR/html401/interact/forms.html#adef-maxlength)

This functionality is not build in, so is there any way for me to add some customization to KO validation to achieve the ability to add the maxLength attribute to an input?

Contributor guide

Open the contributing guide

Research direction

Start by tracing how Knockout validation applies the maxlength rule to an input and where validation metadata is associated with the HTML element. Check how the library supports customization, then verify that a configured maximum is reflected as the element's maxLength attribute and still enforces validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.