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
Mihael Konjević
July 11, 2014
Programming
570
1
Share
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
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
180
Agentic Elixir
whatyouhide
0
450
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
160
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
460
AIを導入する前にやるべきこと
negima
2
360
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
160
ハーネスエンジニアリングとは?
kinopeee
13
7k
PHPer、Cloudflare に引っ越す
suguruooki
2
200
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
180
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
180
Agentic AI & UI: Arcitecture, HITL, Emerging Standards
manfredsteyer
PRO
0
100
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
520
Leo the Paperboy
mayatellez
7
1.8k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Navigating Team Friction
lara
192
16k
How GitHub (no longer) Works
holman
316
150k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
740
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
A Soul's Torment
seathinner
6
2.8k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
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