Best of Support

Hiding fields on a sub-Dialog

Issue

We have some generic Dialogs that function as sub-Dialogs for several different templates.  Occasionally, one or two fields are not relevant for the template type.  Would there be a way via an On enter script to make these fields invisible, based on the type of template that launches the
dialog?

Solution:

Yes, this is certainly possible.  What we typically do is assign a value to an "adhoc" variable in the template, just before the Dialogs.Capture command.  Something like:

%[TemplateType="xxx"]  %[Dialogs.Capture(...)] , etc.

 

Then in the OnLoad Event of the Dialog itself, you can have:

%[IfTrue(TemplateType="xxx",thisdialog.form.fields.FieldName.visible=true, thisdialog.form.fields.FieldName.visible=false)]

 

where FieldName is the name of the field in question.

 

NOTE

If this field happens to reside in a sub-Dialog, or a sub-sub-Dialog, the syntax is:

...thisdialog,subdialogname.subsubdialogname.form.fields.

FieldName.visible=true/false, etc

 

Dan Todes