How to get a field value inside subform using JQuery or JavaScript?



  • Avatar
    Scott Bennett

    Not as straight forward as you would like. I actually get the value from the subform based on a button click where it uses a value in the subform to pop up a window of information. The button does not have a JS call in it but rather a rule where you can access [this]

    In the rule this is the method:


    JS required (ASAppID is the element name of the value in the subform that I want to use):

    function btnAPS(ctrl) {
    try {
    console.log ('Enter the app sts log function',ctrl);
    var val = GetSubFormControlStringValue(ctrl,'ASAppID');
    console.log('Application ID: ', val);'&AppID='+val,'Application Log','height=600,width=800');
    } catch (e) {

    and this is how to get the value from the subform:

    function GetSubFormControlStringValue(ctrl,controlName) {
    console.log ('Enter GetSubFormControlStringValue function');
    console.log ('ctrl: ',ctrl);
    console.log ('controlName: ',controlName);
    var val = $(ctrl).parents(".subFormContentRowChildWrapper").find("[id^='" + controlName + "']").val();
    console.log ('val: ',val);
    return val;

  • Avatar
    SRL Support Team


    thanks a lot.

    In meanwhile, I found that the following syntax works too.

    $("[controlholdername ='+ controlName +']").find("input[id*='+ controlName +']").val();




  • Avatar

    Hi All,
     For me the above methods did not work out. I have another solution 

    1.  To access any element in any section( which is not in subform )
       $(AllFieldsReference['INTERNALFIELDNAME'].querySelector('#INTERNALFIELDNAME ')).val();
    2.  To access any element inside a subform( which can be on any section )
      $(AllFieldsReference['INTERNALSUBFORMNAME '].querySelector('[id^="#INTERNALSUBFORMFIELDNAME "]')).val();


  • Avatar
    Nadia Segura

    The above works for me too, however the JavaScript methods are very useful as well, a bit confusing at the beginning but once you understand it is easy to implement, refer to getFieldValue method from link below  


    This is how I used it:


    var cValue=GetControlValue({"fieldId":"SubFormName/ControlName"});


    function GetControlValue(ctrlName) {
     var ctrlVal ="";

    eFormHelper.getFieldValue (ctrlName, function (res) {
      if (res.isSuccess) { //check if is success   
              console.log(; //logs the data holds the found control's value   
              ctrlVal =;                 
            } else { console.log(res.error); }//logs the error          

    return ctrlVal;


Please sign in to leave a comment.