First of all, I'd like to thank you for an amazing shorthand syntax for Form Validation, that makes working with Semantic UI much more of a pleasure.
Unfortunately what seems for me to be broken is the use of full and shorthand syntax together. In cases of long form where we just want to change one of prompts (f.e. for regexp to state which signs are valid), it forces us to use old syntax all the way.
Is there a possibility to do that? Or maybe I just didn't notice something?
_Tested on Semantic UI package for Meteor, of course updated to 2.1.4_
fields: {
password: ['minLength[5]', 'empty'],
email: 'email',
username: {
identifier: 'username',
rules: [
{
type: 'empty',
prompt: 'Somehow this isn`t working'
}
]
}
}
Error message in console:
"Form:" "There is no rule matching the one you specified" "username"
TypeError: rule.type.match is not a function
They currently don't work together. You have to choose one or the other for now.
Thanks for a fast, clarifying answer. As for the enhancement, imho something like that would be perfect, if possible.
fields: {
password: ['minLength[5]', 'empty', {'myRule', 'myPrompt'}]
}
But just the ability to mix both syntax as they are now will be great.
:+1: using both style together would be super.
until then document should state that Shorthand Validation and Full Validation can't be used together.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
I too have stumbled upon this.
I want to use the shorthand version primarily. But I have some fields that are optional in my form that I would like to validate if something were typed into it. And for this field use the full version.
Would be great if this enhancement would be implemented.
Support of mixing short and full field rules has been supported/fixed in the community fork Fomantic-UI by https://github.com/fomantic/Fomantic-UI/pull/1810
Most helpful comment
:+1: using both style together would be super.
until then document should state that
Shorthand ValidationandFull Validationcan't be used together.