in Search

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Updating/Hidding a value on the fly before it gets displayed

This technique can be used to hide or update HTML content.  With most fields being identified with a <DIV ID=....> tag, you can use the innerHTML method in Javascript. However, let's say you want to change a particular Error message. The error message tag is not idented.  The source code looks like this:

 <TABLE WIDTH=100% CLASS=ErrorContent><TR><TD>Error Mesage</TD></TR></TABLE>

 In order to hide or change it, you will have to use its class instead. The following script can be placed under "Custom Content".

<script for=window event=onload>
function LoadMe(){
document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};
 
var myElement = document.getElementsByClassName('ErrorContent')[0];
 
if (myElement.innerText=='ImpersonateLoggedOnUser2 failed 5'){
myElement.innerText="Please check your domain security settings.";
}
}
LoadMe();
</script>

In the script above, it will change the message if the error is "ImpersonateLoggedOnUser2 failed 5" to something else. 

Comments

 

Panasonic SCBT200 BLU-RAY Home Cinema Multiregion DVD – TJP Home Goods | Home Cinema Insider said:

Pingback from  Panasonic SCBT200 BLU-RAY Home Cinema Multiregion DVD &#8211; TJP Home Goods | Home Cinema Insider

February 7, 2010 7:40

News

To help you find information quickly, use the tag cloud on the righthand side of the page. Every article and file posted is marked with one or more tags. The tags are mainly single words and are listed alphabetically. The more frequently a tag has been used to mark an article the bigger it will appear in the cloud. The tags are hyperlinks that lead to a collection of items that are associated with a tag. To find an article that discusses creating XML feeds using ASP pages, click on ASP, then on the next page click on XML.

This Blog

Syndication

sagecrm.com Articles