Answered by:
problem with ISV buttons

Question
-
hi
I have few ISV buttons like Process, Return, Approved etc. on form
These buttons are displayed based on some condition so i have written code to hide some of these buttons based on some condition.
Suppose for some condition i am displaying only Process button but not Return and Approved buttons.
I am doing this through java script.
Problem is when form is loaded buttons are hidden properly but when i enlarge the form hidden buttons are displayed again on form.
Thursday, August 26, 2010 6:39 AM
Answers
-
Just use the window.onresize event by setting this in your onload.
window.attachEvent('onresize', theHideButtonFunction);
function theHideButtonFunction()
// Place your button hiding code here
MSCRM Bing'd - http://bingsoft.wordpress.com- Proposed as answer by VinothBalasubramanian Thursday, August 26, 2010 7:03 AM
- Marked as answer by DavidJennawayMVP, Moderator Thursday, October 7, 2010 2:07 PM
Thursday, August 26, 2010 7:01 AMModerator
All replies
-
Have you included code to hide buttons on form onload ???
Mahain : http://mahenderpal.wordpress.comThursday, August 26, 2010 6:46 AMModerator -
Yes MahenderThursday, August 26, 2010 6:51 AM
-
This problem will occur sometime. (Not sure on the root cause)
Approch 1:
Empty the OuterHTML instead of emptying the span or disabling the button
var lis = document.getElementsByTagName('LI');
var i = 0;
while (i < lis.length)
{
if (lis[i].getAttribute('title') == '<<Your Title>>')
{
lis[i].outerHTML=''; // instead of lis[i].outerHTML='<SPAN></SPAN>'
}
i = i + 1;
}Drawback: It will be a difficult task to re enable the button. We have to rebuild the span with attach event (easy way is to copy the span tag content onload)
Approch 2:
Handle window resize event onLoad.
window.onresize = function()
{
var lis = document.getElementsByTagName('LI');
var i = 0;
while (i < lis.length)
{
if (lis[i].getAttribute('title') == '<<Your Title>>')
{
lis[i].style.display="none";
}
i = i + 1;
}
}Thanks & Regards
Vinoth- Proposed as answer by VinothBalasubramanian Thursday, August 26, 2010 7:03 AM
Thursday, August 26, 2010 7:00 AM -
Just use the window.onresize event by setting this in your onload.
window.attachEvent('onresize', theHideButtonFunction);
function theHideButtonFunction()
// Place your button hiding code here
MSCRM Bing'd - http://bingsoft.wordpress.com- Proposed as answer by VinothBalasubramanian Thursday, August 26, 2010 7:03 AM
- Marked as answer by DavidJennawayMVP, Moderator Thursday, October 7, 2010 2:07 PM
Thursday, August 26, 2010 7:01 AMModerator -
you can try use setInterval() JS function to to hide your button
refer http://www.switchonthecode.com/tutorials/javascript-tutorial-using-setinterval-and-settimeout
Mahain : http://mahenderpal.wordpress.comThursday, August 26, 2010 7:02 AMModerator -
Thanks to all of you
It is a great help to me.
Thursday, August 26, 2010 7:07 AM