I think it would be useful if error messages could access properties and functions in the model the form element is a part of.
I also think, that because this may require some sort of composition of the string/element, that it should enabled via a config flag on the rule and default to false.
Something like this:
@email({message: '^Nope! ${email_c & oneTime} is not a valid address <a click.delegate="showValid()">Help</a>', compose: true})
email = '';
Example here: (particularly the "email constant" field).
An alternative idea is to allow messages to be handled completely in the template instead of using a renderer. (or a mixture of both potentially if you're adding classes/icons for say bootstrap and need access to the parent form-group).
ie:
<div class="form-group">
<label for="email"> ... </label>
<input value.bind="email & validate">
<validation-messages>
<message for="required" i18n="REQUIRED_FIELD"></message>
<message for="filter">The value '${email | oneTime}' is not valid</message>
</validation-messages>
</div>
Continuing on from Issue #82
I think it would be useful if error messages could access properties and functions in the model the form element is a part of.
I also think, that because this may require some sort of composition of the string/element, that it should enabled via a config flag on the rule and default to false.
Something like this:
Example here: (particularly the "email constant" field).
https://gist.run/?id=bc6bf040204b1e80e13ba57f8244cd58
An alternative idea is to allow messages to be handled completely in the template instead of using a renderer. (or a mixture of both potentially if you're adding classes/icons for say bootstrap and need access to the parent form-group).
ie: