crmForm.all.
The "_c" is the key to allowing you to then go on and use .innerText to change the Label value, or .style.visible for hiding the label.
These scripts work well but the problem with them is that they are not supported and in the next upgrade we may have to go back and change all of our code.
There is an even easier way to hide a label or change its name than through script and its supported. I wish I could say the same for hiding a field but I have yet to find one.
So, what is this supported way? Well, its something so simple I'm sure everyone who's customized CRM has seen it but, like me, they don't pay any attention to it any more and forget that its there.
If you go to the Customization portion within Settings, open up the Form and double click on the field whose label you want to change or hide. The first text box is the name of the label. Just type in there to change what gets displayed on the form as the label of that particular field. Please note that this will NOT change the field's name in Advance Find, you would need to go to the Attributes section and change the Display Name of the attribute for that.
Now, the thing that I figure most people overlook (like I did) is the checkbox labeled "Display label on the form." If you uncheck that checkbox the label on the form will disappear and the textbox on the form will fill in the space of the label.
The only downside to using this approach is that it is a static setting. No dynamic renaming or hiding of the field. But this does the same thing as the scripts, only its supported and actually easier than going out and having to figure out the code to hack the CRM forms.
Fronk
2 comments:
actually, if you want to change the label's text dynamically, the following may be used:
document.getElementById("[attribute_here]_c").innerText = "new text";
Florin,
Thanks for your comment. That's great to know that there is more than one way to get the label. Also that you can dynamically update that label as you so choose through the script you provided.
Thanks for you comment!
David Fronk
Dynamic Methods Inc.
Post a Comment