You need to sign in to do that
Don't have an account?
Del_Santos
Help with Javascript button
Hi,
I created a javascript button to open a vf page if {!Quote.Installation_Address_2__c} is not blank but encountering an error. Im not sure how to define a blank value. i am encountering an invalid token issue.
==========================================
here's the code
if ({!Quote.Installation_Address_2__c}!= null)
{
window.parent.location.href="apex/Generate_Endorsement_Letter_B?id={!Quote.Id}";
}
else {
alert("Site B Installation Address is Missing!");
}
Thanks!
Del
You have to do a blank check when using a merge field, the preprocessor will replace the merge fields with actual values and after that js will run. So eventually it should be blank if value is null.
Try somehting like this
Hi Avi,
tried the code, now the page is coming, however, the page is coming out regardless the field is blank or not.
Many tHanks!
Del
alert('{!JSENCODE(Quote.Installation_Address_2__c)}');
or
console.log('{!JSENCODE(Quote.Installation_Address_2__c)}');
got the problem. the condition did not work field is a formula type. hmm, now i need to check for substitute.
anyone have suggestions? i need to convert this formula field in to text from the code.