Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
can-form
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Mihael Konjević
July 11, 2014
Programming
580
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
can-form
Presentation of the can-form plugin -
https://github.com/retro/can-form
Mihael Konjević
July 11, 2014
More Decks by Mihael Konjević
See All by Mihael Konjević
Developing (with) Keechma
retro
1
280
File uploading with can.Component and jQuery-file-upload
retro
0
670
JSON Schema and APItizer
retro
2
290
Event Oriented Architecture and Client side apps
retro
2
620
Other Decks in Programming
See All in Programming
Oxcを導入して開発体験が向上した話
yug1224
4
290
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.2k
Swiftのレキシカルスコープ管理
kntkymt
0
210
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.2k
The NotImplementedError Problem in Ruby
koic
1
610
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
190
Lessons from Spec-Driven Development
simas
PRO
0
140
Webフレームワークの ベンチマークについて
yusukebe
0
130
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
140
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
230
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.9k
AIで効率化できた業務・日常
ochtum
0
100
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
310
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
エンジニアに許された特別な時間の終わり
watany
107
250k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
420
Making Projects Easy
brettharned
120
6.7k
Become a Pro
speakerdeck
PRO
31
6k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Transcript
can-form Awesome forms for CanJS
Why? • validations and error reporting is a pain •
similar code written over and over again • how do you handle nested object structures?
can-form • can-value is great, use it • behaves like
the can.Component • composable / nestable (allows it to handle nested structures) • validations on the form (validations are bound to context) • simple error reporting and tracking
API FormComponent.extend({ tag : 'simple-form', template : '<content><content>', validate :
{ username : [FormComponent.validationRules.presenceOf()], password : [FormComponent.validationRules.presenceOf()] } }); <simple-form map="{userModel}"> <input type="text" can-value="username"> {{#errors 'username'}} <ul class="bg-danger list-unstyled"> {{#this}} <li>{{ . }}</li> {{/this}} </ul> {{/errors}} <input type="text" can-value="password"> {{#errors 'password'}} <ul class="bg-danger list-unstyled"> {{#this}} <li>{{ . }}</li> {{/this}} </ul> {{/errors}} <button>Submit</button> </simple-form>
API FormComponent.extend({ tag : 'simple-form', template : '<content><content>', validate :
{ username : [FormComponent.validationRules.presenceOf()], password : [FormComponent.validationRules.presenceOf()], 'socialNetworks.*.username' : [FormComponent.validationRules.presenceOf()], 'socialNetworks.*.network' : [FormComponent.validationRules.presenceOf()] } });
API <simple-form map="{userModel}"> <input type="text" can-value="username"> {{#errors 'username'}} <ul class="bg-danger
list-unstyled"> {{#this}} <li>{{ . }}</li> {{/this}} </ul> {{/errors}} … ! {{#each socialNetworks}} <form-for map="{this}" path="socialNetworks.{{@index}}"> <input type="text" can-value="network"> // error reporting code here <input type="text" can-value="username"> // error reporting code here </form-for> {{/each}} <button>Submit</button> </simple-form>
API FormComponent.extend({ tag : 'social-network', template : socialNetworkTemplate, validate :
{ username : [FormComponent.validationRules.presenceOf()], network : [FormComponent.validationRules.presenceOf()] } })
API <simple-form map="{userModel}"> <input type="text" can-value="username"> {{#errors 'username'}} <ul class="bg-danger
list-unstyled"> {{#this}} <li>{{ . }}</li> {{/this}} </ul> {{/errors}} ! … ! {{#each socialNetworks}} <social-network map="{this}" path="socialNetworks.{{@index}}"> </social-network> {{/each}} ! <button>Submit</button> </simple-form>
github.com/retro/can-form @mihaelkonjevic