From 07866b56cce4252327259495102de13c7fc83249 Mon Sep 17 00:00:00 2001 From: Vance Lucas Date: Mon, 13 May 2013 09:22:58 -0500 Subject: [PATCH] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9d40c29..1c83b07 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ To add individual label to rule you simply add the `label` method after the rule $v = new Valitron\Validator(array()); $v->rule('required', 'name')->message('{field} is required')->label('Name'); $v->validate(); +``` There is a edge case to this method, you wouldn't be able to use a array of field names in the rule definition, so one rule per field. So this wouldn't work: @@ -185,6 +186,7 @@ There is a edge case to this method, you wouldn't be able to use a array of fiel $v = new Valitron\Validator(array()); $v->rule('required', array('name', 'email'))->message('{field} is required')->label('Name'); $v->validate(); +``` However we can use a array of labels to solve this issue by simply adding the `labels` method instead: @@ -196,6 +198,7 @@ $v->labels(array( 'email' => 'Email address' )); $v->validate(); +``` This introduces a new set of tags to your error language file which looks like `{field}`, if you are using a rule like `equals` you can access the second value in the language file by incrementing the field with a value like `{field1}`.