Hide a subform according to context node value

Hide a subform according to context node value

To hide a subform using javascript according a context node value in Adobe form :

// data.MAIN.SUBFORM_TO_HIDE::ready:form - (JavaScript, client)
var fieldToCheck= xfa.resolveNode("$record.MAIN.FIELD_VALUE");
if(fieldToCheck.value == null || fieldToCheck.value == "") {
    this.presence = "hidden";

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

4 Comments so far

Ross GoodmanPosted on3:08 am - Mar 14, 2022

H Florian,
I am using your code example to try to hide a subform when a field in that subform is empty. I am still getting the subform displaying however. Could I ask you to check the code below and advise what the issue might be?

data.BODY.HEADING.ADDRESS.#subform[4]::ready:form – (JavaScript, server)

if ((this.resolveNode(“$”).SMTP[1].rawValue == null || this.resolveNode(“$”).SMTP[1].rawValue == “”)) {

this.resolveNode(“$”).presence = “hidden”;


The subform has just two text fields one of which is SMTP[1]

Kind regards,

Ross Goodman

fjourneauPosted on9:27 am - Mar 14, 2022

Hi Ross, my example explains how to hide field according to CONTEXT NODE value.
Here you want to hide accoding to form fields value.
Considering you want to hide subform MYSUBFORM, and the SMTP[1] field is directly under MYSUBFORM, you can write :

data.BODY.HEADING.ADDRESS.MYSUBFORM::ready:form – (JavaScript, server)
if (this.SMTP[1].rawValue == “” || this.SMTP[1].rawValue == null ){
this.presence = “hidden”;


StephanPosted on10:16 am - Jul 20, 2023


est ce que record part de la data view ?

pourriez vous expliquer comme le adresser la bonne node ?

voici ma data view : https://photos.app.goo.gl/BkKg3uo42c4WsyzaA

comment fonctionnerait le xfa.resolveNode(“$record.MAIN.FIELD_VALUE”); si je dois acceder a

– Encore une autre option ?

Leave a Reply