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

Documentation for input binding/validation #54

Closed
jordanmaslyn opened this issue Aug 2, 2018 · 10 comments
Closed

Documentation for input binding/validation #54

jordanmaslyn opened this issue Aug 2, 2018 · 10 comments

Comments

@jordanmaslyn
Copy link

Hi there, forgive me if this is the wrong mode for requesting this, but here goes:

My team is in the process of implementing Aurelia Store throughout several of our apps, however we are having troubles with "best practices" in terms of inputs and validation.

It seems like the best practice for a text input would value.to-view="state.textValue" and then change.delegate="updateTextValue($event)", where updateTextValue dispatches the requisite action.

Where we are having issues though is that some of our inputs are nested within an array. For example, we have an array of clients and we loop through those with repeat.for="client of state.clients" and then have a field to change a given property of each client (e.g. value.to-view="client.email") .

However, when the state observable refreshes, the repeat.for updates and wipes out any error messages/classes created from the ValidationRenderer results.

I wanted to create a reproduction but it appears the gistrun doesn't offer aurelia-store yet. Any thoughts? Is there a better way to accomplish this?

@zewa666
Copy link
Member

zewa666 commented Aug 3, 2018

I'm sorry about the missing gist.run here is an updated one https://gist.run/?id=6e5d8a599932dcdd04f4363c7c731a1a

@jordanmaslyn
Copy link
Author

@zewa666 Thanks for adding that! Seems aurelia-validation is still missing from that bundle. Are you able to easily add that in since the issue I am experience is dependent on the interaction between store/validation.

@zewa666
Copy link
Member

zewa666 commented Aug 3, 2018

@jordanmaslyn updated the gist with Aurelia Validation + Aurelia I18N

@jordanmaslyn
Copy link
Author

@zewa666 I've made some progress at https://gist.run/?id=d7171f9290bb9d777399b0b65ab345b9 but if you look at the console, you'll see an error that looks like it might be related to aurelia/validation#350 where I can't use the validate binding-behavior. This is resulting in the validation renderer receiving no elements.

@zewa666
Copy link
Member

zewa666 commented Aug 4, 2018

Tbh I have no expertise with the validation plugin, maybe @fkleuver or @bigopon can help out here?

@fkleuver
Copy link
Member

@jordanmaslyn @zewa666 It is indeed this error: aurelia/validation#350 (comment)
You're having both version 1.x and 2.x of binding in your bundle. Try upgrading all your aurelia deps, this problem is solved in the latest versions.

@jordanmaslyn
Copy link
Author

@zewa666 Is that something you are able to fix from your bundle?

@fkleuver
Copy link
Member

@zewa666 I can see in your package-lock that there's a few aurelia-binding 1.x's hiding in there. Probably best to just update everything to latest tbh

@zewa666
Copy link
Member

zewa666 commented Aug 15, 2018

Will try to resolve that this week

zewa666 added a commit that referenced this issue Aug 16, 2018
updating the dependencies to get rid of aurelia-binding v1 issue

related issue #54
@zewa666
Copy link
Member

zewa666 commented Aug 16, 2018

I've updated the master with cleaned up dependencies.

@jordanmaslyn can you try to do the following:

  • Install aurelia-store from github/master
  • delete your package-lock.json
  • delete your node_modules folder
  • npm install

@zewa666 zewa666 closed this as completed Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants