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

[Validation] default promt for rule #3001

Closed
listepo opened this issue Sep 11, 2015 · 6 comments
Closed

[Validation] default promt for rule #3001

listepo opened this issue Sep 11, 2015 · 6 comments
Milestone

Comments

@listepo
Copy link

listepo commented Sep 11, 2015

Example:

Declaration:

$.fn.form.settings.defaultPrompts = {
    'empty':'Field is required',
    'creditCard': '{{placeholder}} contains an invalid value: {{value}}'
}
  • {{placeholder}} - current input placeholder
  • {{value}} - current input value

Usage:

$('.ui.form')
  .form({
    fields: {
      name: {
        identifier  : 'name',
        rules: [
          'empty', // or {type: 'empty'}
          'creditCard',
          {
            type   : 'minCount[2]',
            prompt : 'Please select at least two skills'
          }
        ]
     }
  }
});
@jlukic jlukic added this to the 2.1.4 milestone Sep 13, 2015
@jlukic
Copy link
Member

jlukic commented Sep 13, 2015

I've added a form of this in edc9b34

I have not yet added support for those templates values

@listepo
Copy link
Author

listepo commented Sep 13, 2015

@jlukic, thanks 👍

@jlukic
Copy link
Member

jlukic commented Sep 13, 2015

I'm using four templates values

  • {value} - Current value
  • {ruleValue} - bracketed value from rule, i.e. minLength[100] = 100
  • {identifier} - Name from identifier
  • {name} - Text from corresponding field form label

@listepo
Copy link
Author

listepo commented Sep 13, 2015

many people use a form without a label, may make sense to add placeholder?

@jlukic
Copy link
Member

jlukic commented Sep 13, 2015

Will default to placeholder or This field when no label

@listepo
Copy link
Author

listepo commented Sep 13, 2015

it's cool 👍

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

No branches or pull requests

2 participants