Unable to get Datalabel value in JS script.

  • 11 June 2018
  • 3 replies
  • 41 views

Hi,

 

I have a datalabel on my form, setting a number onChange of the checkbox. Want to get this value in the Javascript.

code is like below :

<script>  debugger;    var checkboxIds = [  '53f429d8-78*personal details removed*c58-f3da-09d85cf1348f_1bf76e33-e6f2-4d1f-ae*personal details removed*f29cc4c55',  '1fa2144e-c0*personal details removed*a4c-bebe-30e241ea327f_f078efd1-77f0-59*personal details removed*a-c41c7294ce33_CheckBox',  '1050529c-68*personal details removed*-ab*personal details removed*a3caada80_f078efd1-77f0-59*personal details removed*a-c41c7294ce33_CheckBox'      ];    hideAllCheckBoxes();    function hideAllCheckBoxes() {                //This datalable value I neeed        var $selectionStartDataLable = GetSFControl('dlblCheckedCheckBoxName');        var CheckBoxNumber = $selectionStartDataLable.SFCLabel.Value; //here getting Exception        var exceptionId = checkboxIds[CheckBoxNumber].text;        if (exceptionId) {                   for (var i = 0; i < checkboxIds.length; ++i) {                if (("#" + checkboxIds) == exceptionId) {                    continue;                }                $("#" + checkboxIds).hide();            }        } else {            for (var i = 0; i < checkboxIds.length; ++i) {                $("#" + checkboxIds).show();            }        }    }    function GetSFControlID(ControlName)    { var MyControl = GetSFControl(ControlName);         return MyControl.getAttribute('ID')    }    function GetSFControl(ControlName)     {         var myTextBoxXPath = 'Controllers/Controller/Controls/Control[@Name="' + ControlName + '"]';        var windowToUse = window;         if (!checkExists(windowToUse.viewControllerDefinition))        {             windowToUse.viewControllerDefinition = $xml(windowToUse.__runtimeControllersDefinition);         }         var myControl = windowToUse.$sn(windowToUse.viewControllerDefinition, myTextBoxXPath);        return myControl    }     </script>

3 replies

Badge +8

Hi Shubh,


  


The best would be to contact your Customer Account Manager, and ask them to direct you to the Professional Services team for further assistance.


 


Hope this helps. 

Userlevel 5
Badge +16

Hi,


 


I usually use the following to get a Data label value


 


var dlValue = $('[name = "Data Label"]').html();
Badge +10
function GetSFControl(ControlName) {
var myTextBoxXPath = 'Controllers/Controller/Controls/Control[@Name="' + ControlName + '"]';
var windowToUse = window;
if (!checkExists(windowToUse.viewControllerDefinition)) {
windowToUse.viewControllerDefinition = $xml(windowToUse.__runtimeControllersDefinition);
}
var myControl = windowToUse.$sn(windowToUse.viewControllerDefinition, myTextBoxXPath);
return myControl
}

function GetSFControlID(ControlName) {
var MyControl = GetSFControl(ControlName);
return MyControl.getAttribute('ID')
}

function GetSFControlValue(ControlName) {
return $('#' + GetSFControlID(ControlName)).text();
}

Reply