indexiatech / ember-forms

Smart, Intuitive forms for Ember.js styled with Bootstrap, Multi layouts and Validation support.
http://indexiatech.github.io/ember-forms
Apache License 2.0
218 stars 45 forks source link

Does it work w/out ember-data? #31

Closed toranb closed 10 years ago

toranb commented 10 years ago

Thanks for an amazingly helpful/well documented project! keep up the great work!

2 questions

1.) if I only have a basic ember object (no ember-data) will this work? 2.) how do I inject a simple "model" and use the markup for this very simple app?

https://github.com/toranb/ember-form-example

the controller is here

https://github.com/toranb/ember-form-example/blob/master/js/app/controllers/people.js

the hbs is here

https://github.com/toranb/ember-form-example/blob/master/js/templates/people.handlebars

I believe the refactor will remove almost all of this code (I'd like to see the diff but I found the markup I'm using /below isn't working for that model. Do I need a route to "new up" this model? if not how will this library know what model goes w/ my controller?)

{{#em-form model=model}}
    {{em-input property="name" label="Full Name" placeholder="Enter a name..."}}
    {{em-input property="password" label="Password" placeholder="And password..." type="password"}}
{{/em-form}}
asaf commented 10 years ago

Hey, thank you for the kind words,

for q 1) Sure it can, it has nothing to do with ember-data, as long as your model bound to the form is an ember object.

For q 2) you don't need all of these observers, u can replace this boilerplate code with a simple validations on the controller level and template should be only what u wrote,

Let me just update the docs with example that put the validations on the controller and not on the model,

I'm keeping this open for now

toranb commented 10 years ago

I actually like the model backed form - I just couldn't figure out how to use it with my simple example. Maybe I'm just missing a slightly more detailed example app - I'd gladly push what I have into an example repo for others (after we refactor it with your help and this wonderful library)

asaf commented 10 years ago

@toranb you can create a jsbin if you want

toranb commented 10 years ago

Finally got it working :)

rizkytahara commented 9 years ago

@toranb i also have the same problem with bounding the form and the model for the validation to get work... may i know how to solve it?

toranb commented 9 years ago

I put together an example app a while back but I'm not sure how recent it is :)

https://github.com/toranb/ember-form-example/commits/master

Later I ended up writing my own validation library for this form validation logic (the only diff is you write the form input /html yourself)

https://github.com/toranb/ember-cli-simple-validation