Combining two fields in view mode

By | October 26, 2012

In Sage CRM, I came across one interesting scenario where I want to display two fields combined. Consider the scenario, if I wanted to display an age field like 24 years. In this case I created two fields one text field which contains age value and another one is selection which contains age description like years, months etc.. Below is the client side script which combines the two fields and displays them and one on view screen.
<script for=window event=onload>
if(document.getElementById(“_Datapers_agedescription”))
{

  document.getElementById(“_Captpers_agedescription”).innerHTML= “”;

  var  sAge2HTML = document.getElementById(“_Datapers_agedescription”).innerHTML;

  var  sAgeHTML = document.getElementById(“_Datapers_age”).innerHTML

  var  sCombineHTML = sAgeHTML +”&nbsp;&nbsp;”+ sAge2HTML;

  document.getElementById(“_Datapers_agedescription”).innerHTML = “”;

  document.getElementById(“_Datapers_age”).innerHTML = sCombineHTML 


</script>