mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-13 06:34:08 +03:00
Make sure visitor name is not empty in prechat survey
This commit is contained in:
parent
5628f42782
commit
5d13afd8f6
@ -61,6 +61,18 @@
|
||||
* @param Object attributes Attributes hash for test
|
||||
*/
|
||||
validate: function(attributes) {
|
||||
// Check visitor's name
|
||||
if (this.get('canChangeName') && typeof attributes.name != 'undefined') {
|
||||
var trimmedName = attributes.name
|
||||
// Remove leading spaces from the name
|
||||
.replace(/^\s+/, '')
|
||||
// Remove trailing spaces from the name
|
||||
.replace(/\s+$/, '');
|
||||
if (trimmedName.length === 0) {
|
||||
return Mibew.Localization.trans('Name is required.');
|
||||
}
|
||||
}
|
||||
|
||||
// Check email
|
||||
if (this.get('showEmail')) {
|
||||
if (typeof attributes.email != 'undefined') {
|
||||
|
Loading…
Reference in New Issue
Block a user