function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Salesforce Test 5Salesforce Test 5 

missing ; before statement"

I have a custom button which is supposed to create a new page , but I'm getting the following error when I click it:

"A problem with the OnClick JavaScript for this button or link was encountered: missing ; before statement"

My button executes the following OnClick Javascript:
 
if({!Quote__c.Approved_Artwork_Attached__c} == 0)
{
alert('Approved Artwork has not been uploaded');
}
else
{
window.location.href ='/apex/Testing?CF00N9000000810yt={!Quote__c.Opportunity__c}&CF00N9000000810yu={!Quote__c.Id}&CF00N9000000810yx={!Quote__c.Company_Name__c}&recordTypeName={!Quote__c.Record_type_name__c}';
}

if({!Quote__c.Approved_Artwork_Attached__c} == 0)
{
alert('Approved Artwork has not been uploaded');
}
else
{
window.location.href ='/apex/Testing?quoteId={!Quote__c.Id}&setDefaultValues=true';
}

 
RatanRatan
When we use binding variable in JS always use in single  quotes

Above in IF condition you are using directly 

ie. 
if({!Quote__c.Approved_Artwork_Attached__c} == 0)

 complete code
 
if('{!Quote__c.Approved_Artwork_Attached__c}' == '0')
{
alert('Approved Artwork has not been uploaded');
}
else
{
window.location.href ='/apex/Testing?CF00N9000000810yt={!Quote__c.Opportunity__c}&CF00N9000000810yu={!Quote__c.Id}&CF00N9000000810yx={!Quote__c.Company_Name__c}&recordTypeName={!Quote__c.Record_type_name__c}';
}

if('{!Quote__c.Approved_Artwork_Attached__c}' == '0')
{
alert('Approved Artwork has not been uploaded');
}
else
{
window.location.href ='/apex/Testing?quoteId={!Quote__c.Id}&setDefaultValues=true';
}

try with this..