Reputation: 496
Hi I am retrieving some values from database in onReady function of JS it gives me error Uncaught SyntaxError: Invalid or unexpected token
Below is my onReady function
var clientId = getFieldValue('editForm:clientId');
if (!clientId) {
if ('#{applicationObject.attributes['isProduction']}' == true || '#{applicationObject.attributes['isProduction']}'=='true') {
clientId = '#{applicationObject.attributes['productionClientId']}';
} else {
clientId = '#{applicationObject.attributes['nonProductionClientId']}';
}
}
Ext.getDom('editForm:clientId').value = clientId;
The expected value of clientId is
1:ACP:cSHnNw4v7MhdAGuQ1QF0PnuVOh1PFVBz0u2hlzx81uMR7GJMUBGe08XIKmb/SE7WvMpeprAPPSQw gQd+N+fOdA==
In Chrome debugger it shows as below
Upvotes: 1
Views: 1189
Reputation: 1380
Since you are inserting a multi-line string the easiest here (if you cannot modify that string or do not want to split it and then concatenate using 'line1' + 'line2'
) is to use so called template literals as they support multi-lines. Please also have a look at this question as it's not supported everywhere.
Upvotes: 1