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

invoke validate() manually #35

Open kranya opened 10 years ago

kranya commented 10 years ago

Hello, I would like to use ember-forms.js in my project which has several tabs and one submit button. User can type invalid data in the first tab, switch to other tab and then come back to the first tab. However, inputs are no longer marked as invalid (no red border and no error label). I would like to invoke validation in the route code block after user switches tab. Please advise how to do that. Thanks!

asaf commented 10 years ago

@kranya First, if you want nice tabs component you can use: http://indexiatech.github.io/ember-components/#/component/component.tabs/simple

Either way, regarding your request, I don't see why the validation errors go away, they should be kept, unless every tab of yours is another ember route?

kranya commented 10 years ago

Thank you for the link, I will check it out later. As for my question, yes, every tab is the new route.

asaf commented 10 years ago

yea, so the components states are gone, Ehm, you can use the em-tabs I gave u, which don't switch between routes but gives you a controller per table, state won't be reset that way,

If you want a route per tab, then we need some way to re-trigger validation errors.

kranya commented 10 years ago

@asaf, I have implemented em-tabs components, but it does not look right. Tab names are joined together and there is no tab separators.
Following piece of code: {{#em-tabs configName='bs' selected-idx=0}} {{#em-tab-list}} {{#em-tab}}Foo{{/em-tab}} {{#em-tab}}Bar{{/em-tab}} {{#em-tab}}Baz{{/em-tab}} {{/em-tab-list}} {{#em-tab-panel}} Foo Content {{/em-tab-panel}} {{#em-tab-panel}} Bar Content {{/em-tab-panel}} {{#em-tab-panel}} Baz Content {{/em-tab-panel}} {{/em-tabs}}

looks like this

FooBarBaz Foo Content

I can switch between tabs but why they are joined in a single line and no tab separators?

Is there any other sample on how to use em-tabs? Please advise. Thanks!

BenjaminWinter commented 9 years ago

@asaf i would like to second this issue, but for another application. If a User simply misses a form field which is manadatory(very possible in my app, as there are many non-mandatories as well) no errors will be shown. For that reason i would like to show all errors on click of the submit button.