Rule-based, cross-browser, client side HTML form validation library written in JavaScript
select
Note: In the DOM, all rules are prefixed by
data-fv
. Thedefault
rule does not require an attribute on the DOM element. All rules are processed withAND
logic and thus validation will fail if any requested rule fails.
./src/rules/select-default-rules.js
)
default
: The trimmed value of the selected option must not be emptySee a live example.
<head>
<script type="text/javascript" src="formation.min.js"></script>
</head>
<body>
<form data-formation="1">
<select name="someChoices" data-fv-required="1">
<option value="">— PICK ONE —</option>
<option value="1">Some</option>
<option value="2">Good</option>
<option value="3">Values</option>
</select>
<button
type="submit"
data-fv-form-submit="1"
disabled="disabled">Submit</button>
</form>
</body>