cancel
Showing results for 
Search instead for 
Did you mean: 

JavaScript to hide fields in Adobe Forms

aaron_morden2
Contributor
0 Kudos

Hello all,

I have a subform of type "Flow Content, Top to Bottom".

This subform is bound to a table containing several fields. I want the to hide a field if it is blank.

For example:

Name1

Name2

Name3

If Name2 is blank, it should just be:

Name1

Name3

My JavaScript that I have right now does not work but looks like this:


if (Name2.rawValue = Null)  { 
Name2.presence = "hidden";  
}

What am I doing wrong? Is it because it's a table and I have to access the Name2 field differently?

I am coding this in the Name2 "Initilize" Event? Should it be coded someplace else?

Thank You Very Much!

-Aaron

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Aaron,

I have a subform and i had placed a vertical line. Now when the subform expands vertically in height i want the line also to get expanded (height).

Can anyone please suggestwhat to do.

thanks

Dan

Former Member
0 Kudos

Hi Aaron,

Thanks a lot.it helped me..I cud not see an option to give points to you.

thanks

Dan

Former Member
0 Kudos

Hi Aaron,

I hope you can give me a solution. I am into ABAP. I want to hide a text field based on condition that if it does not contain any value i need to hide it and then compress the space that it occupies. After this, i want to move up the subsequent form/element from below to slightly upwards.

I wrote a code in java script as below:

if (form1.text1.value == NULL)

{

form1.text1.presence = "hidden".

}

now i want to move up the subsequent form/element slightly up.

Please suggest me how to do this?

Thanks

Dan

aaron_morden2
Contributor
0 Kudos

Hey Dan,

You need to set your subform up as:

Content: Flowed

Flow Direction: Top to Bottom

Doing this will cause elements to shift upwards if the preceding element is Hidden.

aaron_morden2
Contributor
0 Kudos

I was able to solve my above problem by entering the following FormCalc in the Form:Ready event. Below is the code.


----- data.testpage.tablesubform.item_subform.OFAC_REPORT.DATA.NAME2::ready:form - (FormCalc, client) 

if ( not HasValue($))  then
     $.presence = "hidden"
endif

0 Kudos

Hi Aaron,

Did it work? I have a similar problem: I have the address info of a company in a INFO Subform

Name1

name2

street, postal code

When name2 is empty, my output should look like:

name1

street, postal code.

I tried with the javascript coding but it's not working. The info subform is positioned but I've wrapped the name2 in a subform, where the content is set to 'Flowed' - Top to bottom.

Do you have any suggestions? what else should I check?

Thanks and best regards,

Laura

aaron_morden2
Contributor
0 Kudos

If someone knows how to do this using FormCalc, that would be useful also.

Thanks!