Mevrael / bunny

BunnyJS - Lightweight native (vanilla) JavaScript (JS) and ECMAScript 6 (ES6) browser library, package of small stand-alone components without dependencies: FormData, upload, image preview, HTML5 validation, Autocomplete, Dropdown, Calendar, Datepicker, Ajax, Datatable, Pagination, URL, Template engine, Element positioning, smooth scrolling, routing, inversion of control and more. Simple syntax and architecture. Next generation jQuery and front-end framework. Documentation and examples available.
https://bunnyjs.com
MIT License
487 stars 39 forks source link

Basic checkbox required validation doesn't seem to work #26

Closed StevenVerbiest closed 6 years ago

StevenVerbiest commented 6 years ago

See JSFiddle:

https://jsfiddle.net/oc0veLLp/3/

The required error is always thrown, even when the checkbox is actually checked.

I am only including

Am I doing something wrong? Did I forget to include a js file? Or is this actually a bug?

Mevrael commented 6 years ago

You have value="" which makes your checkbox useless. Either remove value and let browser set it to default value which is on or set some value like 1 yourself.

Inputs with empty value are not validated as per spec. It is the same as having option in select with empty value.

StevenVerbiest commented 6 years ago

That fixed the issue. Thanks!