piceaTech/ember-rapid-forms

Add required if there is a presence validation on a field

Closed this issue · 10 comments

Now, we will have soon a connection with ember-cp-validation. I think we can add required to fields with a presence validation. We can also add a '*' near the label to say it's required.

What you think ?

What do you mean? It should then automatically make the star? why does it depend on ember-cp-validations?

We can check if there is a presenceValidator on a field then we can add a star on the label. With simple_form. When a field is required, we have something like that :

<label class="string required control-label" for="message_name">* Your name</label>

The class required and the * before the label are added.

But this would force everyone who wants to use this feature to also use ember-cp-validations.

We can do it automatically with ember-cp-validations and do it if we have required=true in the input without ember-cp-validations.

But the presence validator would still come from ember-cp-validations so it would become a hard dependency, right? I'm against making ember-cp-validations a dependency for any feature.

We can make it optional, if like we did for i18n.

ok. You wanna do a PR?

Yep. I'm working on it.

What happened? Is it already done?

Yes, it's fixed by #144