Closed banglashi closed 9 years ago
I haven't updated changelog yet but Astronomy. Validators
had been moved to global var Validators
. Sorry for causing confusion but until the version 1.0 there can be some changes in API.
thanks for the info. Is there any reason behind it? Since the change it seems to conflicts with the https://github.com/meteor-useraccounts/ package. I couldn't find yet the exact point of conflict, but I get following stacktrace
Exception in template helper: Error: The "field" argument in the "hasError" helper has to be provided
at null.<anonymous> (http://localhost:3000/packages/jagi_astronomy-validators.js?be99175fc8959db811953c0a98f4ee90c5b604c5:523:11)
at bindDataContext (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2880:16)
at Blaze._wrapCatchingExceptions (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1651:16)
at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2928:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12)
at wrapHelper (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2927:27)
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?7bafbe05ec09b6bbb6a3b276537e4995ab298a2f:172:18)
at http://localhost:3000/packages/useraccounts_unstyled.js?62e459159e5eb434b6591737b45efa9b15219381:202:26
at null.<anonymous> (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2626:44)
at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1865:18
There are two reasons:
There seems to be problem with the way you use hasError
helper. It isn't conflict with the Meteor UserAccounts package. Take a look at this section https://github.com/jagi/meteor-astronomy-validators#displaying-errors on how to use hasError
helper.
You haven't passed field option. You can do it in two ways.
{{getError "title"}}
{{getError field="title" object=post}}
Let me know if it helped. You can also post here chunk of your template's code.
I checked again, and the useraccounts package seems to register also a helper called hasError defined here https://github.com/meteor-useraccounts/core/blob/flow-router-integration/lib/field.js#L81 and used in the template here https://github.com/meteor-useraccounts/unstyled/blob/master/lib/at_input.html#L16
Any idea how this can be handled properly in meteor? Currently both helpers get run.
Ok you're right. So I will have go back to the old name of this helper from the first version. It was hasValidationError
and getValidationError
. Longer names but it shouldn't cause any name conflict.
By the way, maybe Meteor team should introduce namespacing of global template helpers to avoid names collision. Maybe it would be good feature request.
yes, sounds like a good idea. Thanks for looking into it.
Hi @jagi
somehow after updating I get errors missing the validator implementations. jfyi.