1
0
-1

Hi Experts,

I need to populate data from one field in parent Form to second field in Grid Form form as shown below.

Using hash variable #form.tableName.fieldId# is not an option as parent Form data is not saved yet, so I'm not getting value before "save".

Do you have any idea how to fix this issue? I was also trying to use below CustomHTML code but without success.

 

<script>
$(document).ready(function(){
var diff = FormUtil.getField("ParentFormFieldID"); });
$('input[name=GridFormFieldID]').val(diff);
</script>

 

 

    CommentAdd your comment...

    4 answers

    1.  
      2
      1
      0

      Hi Satria,

      use below code, it works for me (you need to add Custom HTML in grid form and change naming for fields.

      BR,

      Sylwester

       

      <script type="text/javascript">
      //script which is populating data from parent table
          $(document).ready(function(){
              var mainFormField = "parent_field";
              var fieldId = "grid_field";
       
              //get value from parent form
              var value = $('[name='+mainFormField+']:enabled', window.parent.document).val();
       
              //store the value to a field
              $('[name='+fieldId+']:enabled').val(value);
          });
      </script>
        CommentAdd your comment...
      1.  
        1
        0
        -1

        Like it (smile) ... 

          CommentAdd your comment...
        1.  
          1
          0
          -1

          same issue with me

            CommentAdd your comment...
          1.  
            1
            0
            -1

            Hi Sylwester Nowak,

            Maybe you can try this Javascript in the form grid's form:

             
            <script>
            $(document).ready(function(){
            ....
            var ParentValue = $('[name$=ParentFieldId]', window.parent.document).val();
            ....
            </script>
              CommentAdd your comment...