Skip to Content
avatar image
Former Member

Adobe forms - hide field, move fields up

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Dec 01, 2015 at 08:52 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 29, 2008 at 07:56 PM

    instead of the form calc, try to use java script. and also use the event layout:ready,not the initialize event.

    i doubt your script code. i usually follow the code which automatically gives.

    see the correct usage of javascript , i may be wrong in syntax. but it should be some thing like this..

    if( this.rawValue == ''){
     this.presence = "hidden";
    }
    else
    {
    this.presence = "visible";
    }

    Edited by: Vijay Babu Dudla on Oct 29, 2008 4:04 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 30, 2008 at 08:32 PM

    Hi Vijay,

    Thanks for your input.

    I still couldn't fix this issue. In the development environment, once the fields are in a subform, changing the "presence" property to "hidden" is moving the other fields up. I am not able to do it in run time using script (FormCalc or JavaScript). I was able to change the value from blank to a text or vice versa. But, when I change the "presence" property, the value is invisible/hidden but the other fields are not moving up.

    Edited by: Sreeni ChannamRaju on Oct 30, 2008 9:34 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Marcus,

      Generally, you need a bigger subform which has Flowed type.

      Within it, says you insert subform A follow by subform B.

      Hide the whole subform A, and subform B should be move up automatically.

      regards,

      Xiang Li