Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
In this article, we will demonstrate how to retrieve values from a subform. We'll use a simple app as an example, where we read the value from the subform and set it in a form field.
Subform Design
Make sure to remember the Form ID of your subform, it will be necessary for your Custom HTML.
Parent Form Design
This is the Javascript code that reads the value of the subform and sets the field value.
<script> $(document).ready(function(){ selectmain = $(FormUtil.getField("field1")); //Get ID of subform selectmain.on("change",function(){ setTimeout(function(){ select1 = $("#field2_subform_name"); //Get subform value var field1 = FormUtil.getField("field3"); //Get field of form $(field1).val(select1.val()); //Set field to value of subform },100); }); }) </script>
This is the result of the above code:
Download the sample app below: