Comments (8)
What is the expected behaviour? Adding a required
attribute?
from ember-cli-selectize.
Would pass required
to the underlying <select>
which would prevent a form submit.
from ember-cli-selectize.
Fixed in 1871455
Please update to latest version.
Let me know if you have any problems. Thanks.
from ember-cli-selectize.
Works partially, it doesn't submit the form, but it also doesn't show a tooltip saying that this field is required..
from ember-cli-selectize.
but it also doesn't show a tooltip saying that this field is required..
Is this something related with ember-selectize or Selectize itself?
Here's a jsbin with selectize only and required attribute: http://jsbin.com/yoqohadewo/1/edit?html,js,console,output
Nothing really happens. Feel free to change the JSBin if you know how to replicate the expected behavior.
Isn't this a question of styles/theme?
from ember-cli-selectize.
http://jsbin.com/lisucupaka/1/
Hit "Submit" without selecting an option.
from ember-cli-selectize.
Ok, gotcha.
The thing is that Selectize is a wrapper around a select
element. If you inspect the DOM, you can see the underlying select has the style display:none
. What you see with selectize is actually a div that "proxies" or "reflects" to that select element.
That tooltip you see in your JSBin is part of the native select browser features. It may even be different in some browsers, for example.
Selectize's support for required
was done in this PR selectize/selectize.js#136.
Basically:
- If the underlying select has required attribute, selectize adds the
required
class to the wrapper - If a submit is attempted while no value was chosen, selectize adds an
invalid
class to the wrapper (listens to the invalid event) - The styling is up to the developer/theme to do
Check this JSBin: http://jsbin.com/cewesuviqa/1/edit?html,js,console,output
Try to submit and then inspect the DOM. Both required and invalid classes are added.
Ember-selectize focuses on bringing the features of selectize to Ember. This is clearly out of this project scope. But even for Selectize, I don't see a way to do what you need without styling this "invalid" state yourself.
Bootstrap, for example, has styles for these invalid states on all its form controls.
Hope I was clear enough.
from ember-cli-selectize.
Even after updating to the latest version, I am still having problems with this. Why not remove the "required" attribute on the original element? It is still being targeted for focusing and failing if empty on submit, causing browser errors in the console.
from ember-cli-selectize.
Related Issues (20)
- hideSelected and multiple don't work together HOT 1
- v0.5.8 broke the selectize styles HOT 4
- selectize.js:2151 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
- multiple mode bug? HOT 2
- Selectize changing my model property to null
- Best Practice for adding/removing on a REST/API error
- add 'readOnly' to 'generalOptions ' HOT 2
- Move selectize and sifter from Bower to NPM HOT 3
- select-item action should not fire when selection promise resolves. HOT 1
- Using multiple=true with ember-changeset-validations HOT 3
- Add Support for data-dash-attributes
- Can't install due to missing dependency HOT 1
- Label truncates when second word contains letters in the first in multiple mode HOT 1
- Tooltip for list
- 2 selectors in the same template and options visible for both of them at the same time HOT 1
- Fix breaking changes in FastBoot 1.0 HOT 1
- Migration to power select HOT 1
- DEPRECATION HOT 1
- Deprecated calls to sendAction
- ember-cli-selectize triggers a Maximum Call Stack exceeded errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-selectize.