Skip to content

Commit 3e83104

Browse files
committed
Added Yii 2.0.6 APIs
1 parent e640e2f commit 3e83104

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

book/forms-activeform-js.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,27 @@ $('#contact-form').yiiActiveForm('add', {
5353
});
5454
```
5555

56+
Updating error of a signle attribute
57+
------------------------------------
58+
59+
In order to add error to the attribute:
60+
61+
```javascript
62+
$('#contact-form').yiiActiveForm('updateAttribute', 'contactform-subject', ["I have an error..."]);
63+
```
64+
65+
In order to remove it:
66+
67+
```javascript
68+
$('#contact-form').yiiActiveForm('updateAttribute', 'contactform-subject', '');
69+
```
70+
71+
Update error messages and, optionally, summary
72+
----------------------------------------------
73+
74+
```javascript
75+
$('#contact-form').yiiActiveForm('updateMessages', {
76+
'contactform-subject': ['Really?'],
77+
'contactform-email': ['I don\'t like it!']
78+
}, 'There are errors!');
79+
```

0 commit comments

Comments
 (0)