Comments (3)
Sorry, some issue with the twiddle. Twiddle not saving my code. Please find the template code.
{{#validated-form
model=(changeset model UserValidations)
on-submit = (action "submit")
submit-label = 'Save' as |f|}}
{{f.input label="First name" name="firstName"}}
{{#f.input label="Last name" name="lastName" as |fi|}}
{{textarea name="lastName" onupdate=fi.update onhover=fi.setDirty
{{/f.input}}
{{f.submit label="Save" disabled=f.model.isInvalid}}
{{/validated-form}}
from ember-validated-form.
Hi @g8anusha,
the key to achieving this behaviour is calling fi.setDirty
when your component goes out of focus. Getting this right can sometimes be tricky because how the event is triggered depends on the component you're using: onhover
is for example just used in our demo app and won't work with textareas. When you're using the ember {{textarea}}
you'll have to use input
and focusout
(see ember docs), with a native <textarea>
it would be oninput
and onblur
.
I created a twiddle with a working demo.
So, to summarize: It really depends on what kind of custom component you're using. Textareas might not be a perfect example since we support them out of the box anyway. For debugging purposes, I'd recomment to bind you event listener to a custom action to see if it actually gets fired before changing it to call fi.update
or fi.setDirty
.
Hope that helps!
PS: My current workflow with ember twiddle is to name the twiddle, then hit File > save to GitHub Gist, and finally open the current page in a new Tab to see if everything actually has been saved.
from ember-validated-form.
Worked like magic! Thanks a lot! 💯
from ember-validated-form.
Related Issues (20)
- Optional instead of required
- Dummy app is not loading HOT 1
- Configuration in config/environment.js not working? HOT 4
- TODO: Migrate from ember-i18n to ember-intl HOT 1
- Bootstrap classes not generating HOT 5
- queue is not a helper HOT 1
- Fails to build with embroider
- type=number additional properties HOT 1
- v1 version does not honor previous locale setting of ember-intl HOT 1
- Errors aren't being updated HOT 3
- Release v3.0.3? HOT 2
- Submit event missing event and sender parameters
- Documentation page unusable ("htmlsafe is not a function")
- Cleanup after embroider fixes HOT 1
- Docs are busted HOT 2
- Nested properties not validating (solved) HOT 1
- Help needed to use "on" modifier with <ValidatedInput /> HOT 2
- Adding custom inputs
- Embroider Support is broken HOT 1
- Master is incompatible with node < 18 HOT 2
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-validated-form.