You need to sign in to do that
Don't have an account?

Javascript onClick button
Hello - I'm using this java script on my button to make sure the address is filled out... But since i started using window.open it opens this new page in a new tab.
I want it to be the same tab and just go to the new page like before. Is there a different function i should be using to open this?
Thanks!
I want it to be the same tab and just go to the new page like before. Is there a different function i should be using to open this?
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")} var leadAddress = '{!Lead.Street}'; var leadCity = '{!Lead.City}'; var leadState = '{!Lead.State}'; var leadCountry = '{!Lead.Country}'; var leadZip = '{!Lead.PostalCode}'; if(leadAddress == null || leadAddress == ''){ alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); } else if(leadCity == null || leadCity == ''){ alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); } else if(leadState == null || leadState == ''){ alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); } else if(leadCountry == null || leadCountry == ''){ alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); } else if(leadZip == null || leadZip == ''){ alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); } else{ var urlStr = '/a0J/e?' + 'CF00Nj00000091TUH={!Lead.FirstName &" "& Lead.LastName }' + '&CF00Nj00000091TUH_lkid={!Lead.Id}' + '&retURL=%2F{!Lead.Id}' + '&saveURL=%2F{!Lead.Id}' + '&RecordType=012j0000000pfbL' + '&ent=01Ij0000001EVex' + '&00Nj00000091TU6={!Lead.Company}' + '&00Nj00000091TUQ=Pending'; window.open(urlStr); }
Thanks!
This behavior is browser dependent and may work for some browsers only.
All Answers
Please try with below code and let me know if you are facing any issues
Thanks,
Prem Anandh
window.location.href = urlStr;
This behavior is browser dependent and may work for some browsers only.