You need to sign in to do that
Don't have an account?
Javascript Button Code issue
Hi All,
Is there any changes that occurred in 'setAttribute' and 'getAttribute' javascript functions in Winter 16 release Orgs?
1. Create a 'Detail Page Button' say " Test1 "on any Object, and include the following syntax:
alert(this.getAttribute('class'));
(or)
alert(this.setAttribute('class', 'btnDisabled'));
2. Assign the created button " Test1 " to the related page layout of Object.
3. Click " Test1 "
In Winter 16 Upgraded Orgs, it will throw the error:
=========
A problem with the OnClick JavaScript for this button or link was encountered:
this.setAttribute is not a function
========
In Summer 15 Orgs,it will not throw the error and works as expected.
Regards,
Yaswanth K
Is there any changes that occurred in 'setAttribute' and 'getAttribute' javascript functions in Winter 16 release Orgs?
1. Create a 'Detail Page Button' say " Test1 "on any Object, and include the following syntax:
alert(this.getAttribute('class'));
(or)
alert(this.setAttribute('class', 'btnDisabled'));
2. Assign the created button " Test1 " to the related page layout of Object.
3. Click " Test1 "
In Winter 16 Upgraded Orgs, it will throw the error:
=========
A problem with the OnClick JavaScript for this button or link was encountered:
this.setAttribute is not a function
========
In Summer 15 Orgs,it will not throw the error and works as expected.
Regards,
Yaswanth K
$('input[name=Test1]').addClass('btnDisabled');
Not sure why JS has stopped in this release but workaround is to implement the same logic using JQuery.
All Answers
I am not sure about the change in winter 16 release,
But I have used the following statement for disabling a clicked button.
try using this this.className = "btnDisabled";
Hope this helps you
Hi Jeet,
I have tried as mentioned and it does work in Summer 15 org as I said it is not working in Winter 16 org.
Other ways I have tried:
- getElementsByName('Test1').class='btnDisabled';
or
- this.class='btnDisabled';
or
- var x = document.getElementsByName('Test1');
this.class='btnDisabled';
None of them works in release Orgs.
Thanks!!
$('input[name=Test1]').addClass('btnDisabled');
Not sure why JS has stopped in this release but workaround is to implement the same logic using JQuery.