cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adobe forms - hide field, move fields up

Former Member
53,466

Hello,

I am a newbie trying to fix an Adobe forms issue. I am using LiveCycle Designer 7.1 and scripting using FormCalc.

I have three address fields stras, street_4, city_zip displayed one below the other. Field street_4 is not mandatory.

If street_4 is blank, the address should be displayed as follows:

stras

city_zip

If street_4 contains a value, it should be displayed as:

stras

street_4

city_zip

I created a subform wraping all the three fields. Wrote a (FormCalc, Client) script in the initialize event of street_4. If street_4 is blank, an empty space is being displayed. Any help would be greatly appreciated.

if (HasValue($) == 0)

then $.presence = "hidden"

else $.presence = "visible"

endif

Thanks,

Sreeni

View Entire Topic
Former Member

Hi Sreeni,

I think the problem is already solved but i have some input for all the guys who might come over this issue and are not able to solve it:

I will focus on JavaScript because I am more into that than into FormCalc scripting.

  • The main problem is that you use the value "hidden" for the presence attribute.

The solution to this problem is the following:

  1. Using this.presence = "hidden"; will hide the complete element on your form. Thus, all the elements which are below the hidden one are moved up.
  2. Using this.presence = "invisible"; will only hide the text inside the element not the element itself. Thus, the elements below stay where they are and nothing gets shifted.

So this is not really dependent on using subforms. You can hide the whole subform using this technique or only elements inside the subform.

Here a short code snippet:

  1. Hide the whole element and shift lower elements up:

data.MAIN.HeaderData.ADDRESS_DATA.ADDRESS_DATA_ITEM.NAME2::validate - (JavaScript, client)

if ($record.ADDRESS_DATA.NAME2.value == null || $record.ADDRESS_DATA.NAME2.value == ''){

     this.presence = "hidden";

}

     2. Hiding only the TEXT INSIDE the element NOT the element itself ==> no shifting of other elements:

data.MAIN.HeaderData.ADDRESS_DATA.ADDRESS_DATA_ITEM.NAME3::validate - (JavaScript, client)

if ($record.ADDRESS_DATA.NAME3.value == null || $record.ADDRESS_DATA.NAME3.value == ''){

this.presence = "invisible";

}

Regards Patrick