Expand my Community achievements bar.

Using JavaScript to show/hide fragments

Avatar

Level 2

Hi,

Can anyone point me in the direction of information or an example of JavaScript being used to show or hide fragments within a form?

I'm looking to add JavaScript to the XDP content of my fragments so that these fragments will be shown or hidden depending on the evaluation of certain conditions.

If I create a form, and reference a fragment within that, then I can hide the fragment using this JavasScipt embedded within the form:

xfa.form.MyForm.MyForm.MyFragment.presence="hidden"

However, I'm looking to add the JavaScript to my fragment. I've used similar JavaScript but when the form and fragment are assembled the fragment is always displayed.

Can anyone help here please?

Thanks,

Ray.

1 Reply

Avatar

Level 2

Hi,

Can anyone help here at all?

All that I need for now is how to get JavaScript included in my fragment invoked when a form that includes that fragment is assembled.

When the fragment is rendered by itself the JavaScript is invoked. But not when it's rendered from within another form. Why is this?

Thanks,

Ray.