Align field data to Right Hand Side on Edit and Summary Screen

By | February 23, 2017

Hello All! In previous blogs, we had seen that how we can make our SAGE CRM screens and grids more visually effective by applying JAVASCRIPT, JQuery, HTML, etc. like by highlighting checkboxes, underlining to column header, printing amount in words, and others. Here, we will see how we can align field data to Right Hand Side of screen using JQuery.
New Stuff: Make better business decisions with consolidated insights of your accounting & customer information using GUMU™ integration for Sage CRM with Sage 50 US
We were asked by one of our customer to set the value of particular field to the RHS while making entries and after saving the same. To achieve this we applied the JQuery style.textAlign and float property which is explained in below steps.
Step 1:
Prepare a custom page (e.g. Case.js) and give the reference of the same in Custom Content of the required screen.

Step 2:
Write the below code in the custom page.
if(document.getElementById(“case_customerref”))  // Code for Edit Mode
            {
                        document.getElementById(“case_customerref”).style.textAlign = “right”;
            }
            else if(document.getElementById(“_HIDDENcase_customerref”))  // Code for View Mode – Summary
            {
                        $(‘#_Datacase_customerref’).attr(‘style’,’ float:right;’);
                        $(‘#_Datacase_customerref’).closest(“td”).width(’80px’);  // Set the width as per screen
            }
Step 3:
After saving the code, “style.textAlign” property aligns the data to RHS on Edit/New screen and “attr(‘style’,’ float:right;’)” on Summary screen. See the effect in below snapshots.


Happy Scripting..!! 🙂
Also Read:
1) How to modify Field’s Caption and Data box alignment in Sage CRM?
2) Center Align List/Grid Data
3) Alignment of buttons on custom filter screens
4) Grid column header alignment
5) JavaScript to print Amount (In Words)