Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is using a path as property argument for <BsForm::Element> supported? #1173

Open
jelhan opened this issue Aug 7, 2020 · 3 comments
Open
Labels

Comments

@jelhan
Copy link
Contributor

jelhan commented Aug 7, 2020

A consumer may try to use a path as @property argument for <BsForm::Element>. Is this officially supported? Should we support it?

<BsForm
  @model={{hash
    address=(
      hash street=""
     )
  }}
  as |form|
>
  <form.element @property="address.street" />
</BsForm>

It seems to have worked in the past but was broken due to refactoring at least if using ember-changeset-validations as validation provider. We started to address it in ember-bootstrap/ember-bootstrap-changeset-validations#28 but more bugs were catched in ember-bootstrap/ember-bootstrap-changeset-validations#30. Before fixing in validation plugin I want to discuss if we have or want to commit to support in Ember Bootstrap itself.

It's not covered by current API docs:

The property name of the form element's model (by default the model of its parent Components.Form) that this form element should represent. The control element's value will automatically be bound to the model property's value.

Using this property enables form validation on this element.

I haven't had the time yet to go through the tests and see if we have test coverage for it.

@simonihmig
Copy link
Contributor

I don't think this is really supported, at least I never had that explicitly in my mind. And I think that supporting that is probably not trivial with validations in mind. Like when using ember-cp-validations and you have an Ember.Object foo with the validation mixin, and another nested object with its own validations under the bar property, setting foo.bar would currently not allow us to see the validations defined on bar (when foo is the form's model).

Nevertheless it would be nice to add support for that in the future, but probably that will happen only as part (or thereafter) of a bigger validation API refactoring!?

@jelhan
Copy link
Contributor Author

jelhan commented Aug 7, 2020

I'm not sure if I would see missing support in a validation provider plugin as a showstopper. We might support from Ember Bootstrap but it may not be supported by a specific validation provider (or it's plugin).

@basz
Copy link
Contributor

basz commented Aug 10, 2020

Seems to run fine with 3.20... https://travis-ci.org/github/kaliber5/ember-bootstrap-changeset-validations/builds/716497258

For me that means I'm going to spend time upgrading my application and continue to use ember-bootstrap in an unofficially supported way...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants