check 'defaultValue' before calling 'replace'

fix error "defaultValue.replace is not a function" when defaultValue is Integer
This commit is contained in:
Rodion
2015-12-17 20:14:09 +03:00
parent 85b0f4bab0
commit 63951d0bf8

View File

@@ -32,7 +32,9 @@ Handlebars.registerHelper('renderTextParam', function(param) {
idAtt = ' id=\'' + param.valueId + '\''; idAtt = ' id=\'' + param.valueId + '\'';
} }
defaultValue = defaultValue.replace(/'/g,'''); if (typeof defaultValue === 'string' || defaultValue instanceof String) {
defaultValue = defaultValue.replace(/'/g,''');
}
if(isArray) { if(isArray) {
result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'' + idAtt + dataVendorExtensions; result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'' + idAtt + dataVendorExtensions;