Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

checking for the existance of Dynamic forms

Avatar

Former Community Member
Scenario:<br />I have a form that uses the instance manager to add and remove instances of subforms. When an instance of a subform is added, some of the fields on the subform are to be mandatory. I have a script that checks these fields and displays a message box to the user if the field is empty.<br /><br />Problem:<br />I need a method to see if the subform exists or not. If the form exists, I check the fields for data, otherwise skip to next subform.<br /><br />More info:<br />-I'm using JavaScript<br /><br />Code:<br />I need something to replace <parent.childsubform exists> below...<br />if(<parent.childsubform exists>){<br /> if(parent.childsubform.textbox.rawvalue == null){<br /> app.alert('Please fill the mandatory text box field');<br /> }<br />}<br /><br />Thanks in advance...
1 Reply

Avatar

Former Community Member
Hi,



you could try this:



var bExists = true;



try {

var childSubFormBlk = parent.childSubForm;

} catch(e) {

var bExists = false;

}



if (bExists) {

...