It is a small extension for ExtJs library.
It displays small and no-annoying messages to user. For example:
or
##Usage:
- Sure you have to use ExtJs (was tested only with ExtJs 3.x)
- Copy
js
,css
andimage
folders to project and includecss/tooltip.css
andjs/tooltip.js
to your html page - Profit!!!
##Displaying success message Ext.Tips.msg('Success', 'Operation was completed');
##Displaying error message
Ext.Tips.popup(Ext.Tips.CRITICAL, 'Unable to delete user.');
You can also use Ext.Tips.WARNING
, Ext.Tips.INFO
or Ext.Tips.HELP
for different styling
##And displaying form errors Some times we have tabs inside a form, and user cannot see validation error at unactive tabs. So you can show it with tooltip: Ext.Tips.formErrors(form);
Also you can display validation errors, which was returned from the server: Ext.Tips.formErrors(form, response.result.errors);
Where response.result.errors
is an array of objects. For example:
[
{
"id": "email",
"msg": "Email '[email protected]' is already in use"
},
{
"id": "login",
"msg": "Login 'user' is already in use"
},
{
"msg": "You have no rights for adding new users"
}
]
So, id
is a field name that contains an error and msg
is an error message.
There is no id
in the last array item, it is okay - just general error message with no connection to some field.