1
0
-1

Hi All,

I have below question.

How can I transfer value from parent table to a child table, but in case parent table hasn't been submitted yet.

I was using below code, but it works only after parent table has been submitted before adding some grid elements.

Is it possible, if yes any idea how to make it?

 

 

 

<script type="text/javascript">
    //script which is moving vendor data from parent table
    $(document).ready(function(){
        var mainFormField = "cpo_cpo_number";
        var fieldId = "3pp_cpo_number";
 
        //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...

    3 answers

    1.  
      2
      1
      0

      I just tried your script on my own app and it works even though the form is not submitted before.

      Try to insert "alert(value)" code or "console.log(value)" code somewhere in your code to debug.

      <script type="text/javascript">
          //script which is moving vendor data from parent table
          $(document).ready(function(){
              var mainFormField = "cpo_cpo_number";
              var fieldId = "3pp_cpo_number";
              //get value from parent form
              var value = $('[name='+mainFormField+']:enabled', window.parent.document).val();
              alert( "value is " + value);
              //store the value to a field
              $('[name='+fieldId+']:enabled').val(value);
          });
      </script>

       

       
      1. alaskan

        Hi, if to value form radio button, should i modify the script? can u advide the code?

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

      Hi, if to pass value from radio button, should i modify the script? anybody can advice for the script? 

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

        Hi,

         

        I also having the same problem...I use the same code and put the alert to see the value but the alert show "Undefined" value.

         

         

          CommentAdd your comment...