+ Start a Discussion
sam_Adminsam_Admin 

Help with Javascript Button

Hi,
   I tried creating this button but iam getting this error "A problem with the OnClick JavaScript for this button or link was encountered:invalid regular expression flag e". What iam doing wrong?

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}

var Status = '{!ELA__c.Status__c}';

if(Status == "Active")
{window.location = /a02/e?
retURL=%2F{!ELA__c.Id}
&RecordType=01240000000M83B
&00N40000002Hvox="ELA"
&00N40000003BOiQ={!ELA__c.Name}
&00N40000002HvWZ="IRB"
}
else if(Status = "Inactive")
{window.location = /a02/e?
retURL=%2F{!ELA__c.Id}
&RecordType=01240000000M83B
&00N40000002Hvox="BLA"
&00N40000003BOiQ={!ELA__c.Name}
&00N40000002HvWZ="CRB"
}
BalajiRanganathanBalajiRanganathan
you should have value for window.location with in a single quotes

window.location = 'http://test.com';
 
sam_Adminsam_Admin
Iam getting this error

A problem with the OnClick JavaScript for this button or link was encountered:

expected expression, got '%'