cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding a field based on another field

Koja78
Participant
0 Kudos

A.S.: Yes, I have searched through the forum in vain

My requirement:

Within a flowed subform I have:

     - radiobutton with values Yes/No.

     - a flowed subform containing:

          - a textfield element

When the value Yes is selected, the textfield should be available for input.. in the other case it should disappear.

I am however unable to set the field hidden..  I can toggle editable or not.

The code I have:

if (this.rawValue == "X"){

     this.resolveNode("parent.subform.textfield").access = "open";

else{

     this.resolveNode("parent.subform.textfield").access = "readOnly";

}

This works in the layout:ready event to put the field editable or non editable according to the radiobox selected.  (the event is on the radiobutton)

The code I would think I need to hide the field would be as follows:

if (this.rawValue == "X"){

     this.resolveNode("parent.subform.textfield").presence = "visible";;

else{

     this.resolveNode("parent.subform.textfield").precense = "hidden";

}

However this does not work.  I have also tried to place it in the change event... still does not work.

I have also tried with absolute references.

So....

1. Is my suggested code faulty?

2. Should I place it in yet another event?

3. Is what I want not possible?

4. Should I just buy valium and go to sleep?

Kind regards and cuddles to whomever solves this...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This blog gives you a hint that the PDF needs to be rendered as a dynamic PDF form:

https://scn.sap.com/people/juergen.hauser2/blog/2006/01/31/access-mode-and-presence-of-fields-on-ado...

Koja78
Participant
0 Kudos

I only get "adobe pdf file" as type

Koja78
Participant
0 Kudos

anyway.. isn't the fact that you can change date meaning that it's "de facto" dynamic?

Koja78
Participant
0 Kudos

It was static... now it's interactive...  I can hide the field and make it reappear but it's like using access.readOnly en open....   the fields don't compress.. although the form is flowed.

Former Member
0 Kudos

It is actually interactive vs. (flat) print PDF and static vs dynamic.

interactive allows you to make changes, i.e. form fields are interactive.

static means no re-layouting of the form is necessary and hence dynamic means re-layouting might be necessary.

All frameworks and APIs have "dynamic" as a flag an you'll need to turn this on if you are dynamically showing/hiding form fields. In an ABAP print program use for example: gs_docparams-dynamic = abap_true.

In Designer you can use preview and select in the preview properties (Form Properties...) "dynamic XML form".

Koja78
Participant
0 Kudos

Yes indeed,

ls_docparams-fillable = 'X'.
ls_docparams-dynamic  = 'X'.

I had the first and added the second.  Still the same as described above...

Former Member
0 Kudos

Did you copy the code in your question? Because in the else branch there is a typo in presence.

Answers (0)