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
Vj@88Vj@88 

Unexpected Identifier when running a Javascript button

I created a custom detail page button that executes the following Javascipt 
if({!Quote.Approval_Validation__c} == "")
{
window.open('/apex/Quotesubmit?id={!Quote.Id}'}
}
else
{
alert ("You can submit for Approval. Please check the Approval Validation on the top pd the Page to meet the requirements for submitting Approval");

}

When I click the button its giving me the error 'Unexpected Identifier'
I am new to Java script. Can anyone help me on this?
siddarth rajsiddarth raj

Hi

In Java script I believe you could not use controller reference striagthly. I guess 'Quote.Approval_Validation__c' must have been referred to some component on the page.. If so use that componet in Javascript to find the value.

For example

<apex:outputtext  id="test" value="{!Quote.Approval_Validation__c}" />

//IN Java script

document.getelementById($componet.test)
GOO DLUCK

-Siddarth
Vj@88Vj@88
I got it! We need to include the fields in quotation marks "" like to get rid of error

If( "{!Quote.Approval_Validation__c}" == "")

Thanks Anyway!