Getting Value of Subform Script Don't work

Confluence User - 08 Mar, 2024

   Hi Everybody,

   I'm testing this recomendation Getting Value of Subform and note that it don't work as expected, please anybody can try to use the demo and tell me if have solution to fix it? .  I'm nedding use this script to improve my application.

Bellow is the evidence of the problem, I have did two tests in different testing enviroments and get the same issue.


thanks

javascript;subform;forms

2


09 Mar, 2024
confluenceUser
1
confluenceUser

You can refer to code in Getting Value of Subform 

                my_name = $("#field2_subform_name"); //Get subform value

You will need to add prefix of your subform ID and subform form name when calling.


16 Mar, 2024
confluenceUser
confluenceUser

My Friend Bastiana , I found the problem in the original code that come with the demo application .

The code lack of this part in bold

<script type="text/javascript">
    $(document).ready(function(){
        selectmain = $(FormUtil.getField("field1")); //Get ID of subform
        selectmain.on("change",function(){
            setTimeout(function(){
                my_name = $("#field2_subform_name"); //Get subform value
                my_country = $("#field2_subform_country");
                my_date = $("#field2_subform_date");
                var field1 = FormUtil.getField("field3"); //Get field of form
                var field2 = FormUtil.getField("field4");
                $(field1).val(my_name.val()); //Set field to value of subform
                $(field2).val(my_country.val());
            },1200);
        });
    })
</script>


Now is working fine.


RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print