cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic visibility of form fields

Former Member
0 Kudos

Hi,

In my form there are two fields ( Dropdown and another is radio button group). The condition is if the dropdown has no value selected, the radio button group shouldn't appear on the form. And the moment some value gets selected from dropdown, the radio button group should appear on the form. I guess some java scripting is required and I tried with this:

if (CarGrade.selectedIndex.value = 0)

{

ISR_RadioButtonListGroup.ISR_RadioButtonList.ISR_RadioButton.presence = "invisible";

}

else

{

ISR_RadioButtonListGroup.ISR_RadioButtonList.ISR_RadioButton.presence = "visible";

}

But its not working, plz help.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

I changed it to Form Calc too but

No, still it doesn't work.

Former Member
0 Kudos

Hi Himanshu,

Have u enabled the Dynamic property of ur Interavtive Form through doModifyView method of the view containing the Form.

try placing this code in the doModifyView method of the view containing the Form:

IWDInteractiveForm IForm = (IWDInteractiveForm)view.getElement(" Name of ur Interactive Form as in Outline View");

IForm.setDynamicPDF(true);

Hope this will help...!!

Thanks

Amita

Former Member
0 Kudos

I suppose code of Amita won`t work, because setDynamicPDF function is deprecated now. Instead if that you should use

WDPDFDocumentFactory.getDocumentHandler(view, "Name of your Adobe Form").getDocumentContext().setDynamic(true);

Former Member
0 Kudos

Hi Madhu,

Still its not working.

What I have done now

in the initialize event of radio button group I have put

ISR_RadioButtonListGroup.ISR_RadioButtonList.access = "readOnly";

and in change event of dropdown I have put

if (CarGrade.selectedIndex.value = 0)

{

ISR_RadioButtonListGroup.ISR_RadioButtonList.access = "readOnly";

}

else

{

ISR_RadioButtonListGroup.ISR_RadioButtonList.access = "open";

}

This piece of code is working perfectly fine and also when I put

ISR_RadioButtonListGroup.ISR_RadioButtonList.access = "invisible"; in the initialize event of radio button group

The Radio buttons are getting hidden out.

But the following piece of code suggested by you is not working:

var a = this.boundItem(xfa.event.newText);

if ( a == null || a == " " )

{

ISR_RadioButtonListGroup.ISR_RadioButtonList.ISR_RadioButton.presence = "invisible";

}

else

{

ISR_RadioButtonListGroup.ISR_RadioButtonList.ISR_RadioButton.presence = "visible";

}

Plz help

0 Kudos

Hi,

place the below script in the Change Event of the DropDownList and Script Language as JavaScript.

var a = this.boundItem(xfa.event.newText);

if ( a == null || a == " " )

{

ISR_RadioButtonListGroup.presence = "invisible";

}

else

{

ISR_RadioButtonListGroup.presence = "visible";

}

Thanks & Regards,

Madhu.

Former Member
0 Kudos

Hi,

Thanks a lot for suggestions.

But unfortunately the dynamic visibility is not working with the java script code as suggested.

Is there any other way or any other idea.

Plz help

Former Member
0 Kudos

Himanshu,

that's not javasript, it's Formcalc.. Try changing the code type to Formcalc & see if it works

Former Member
0 Kudos

I put the above code behind the CLICK event of my dropdown box and also at the DOCREADY event.

I put it at the DOCREADY event to default the fields to invisible.

Former Member
0 Kudos

this should be relatively simple to do....

i'm using formcalc in this instance to check if a field's input is populated with certain values - if so, then make a field and its caption visible.


if (( PROJ_CLASSIFICATION.rawValue eq "Discretionary")  or
     ( PROJ_CLASSIFICATION.rawValue eq "Mandatory"))
then
 BENEFIT2.presence = "visible"
 ben2txt.presence = "visible"

else
  BENEFIT2.presence = "invisible"
  ben2txt.presence = "invisible"

endif