cancel
Showing results for 
Search instead for 
Did you mean: 

Hide Text Field at run time

Former Member
0 Kudos

Hi,

I am trying to hide a text field when it is empty in Adobe form .

The code for this



if( hasValue($record.LOCAT) ) 
LOCAT.presence eq 'visible' 
else LOCAT.presence eq 'hidden'
endif.

I have written this code in the initialise event for the text field.

As far as I know this is possible for interactive forms. Is there a possible way to implement it in for static adobe form.

I am very new to both Adobe form and java scrpit.

Please help me .

Rashi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

yes, this is possible in a static form

try using an "=" instead of "eq" - that may help... otherwise your problem may be due to your hasValue($record.LOCAT) statement


if ( yes.rawValue eq "1" ) then
data.Page2.grp2.fin.text.ifyes.presence  = "visible"
endif

here's a very helpful resource on scripting

http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

Former Member
0 Kudos

Hi,

I tried both ur suggestions but no luck.

I also went through the document and implemented the following changes to my form

Created a script object with a function in it trying to make the text field hidden in all cases

function emptyCheck(oField){
if ((oField.rawValue == null) || (oField.rawValue == "")) {
oFieild.presence = "hidden";
}
else{
oFieild.presence = "hidden";
}

}

and then applied to my text field in the initialize event

script_obj.emptyCheck(this);

While testing (print preview) it is not showing any error but when I am running my form it still shows the text field.

My requirement is this that if the field is empty it should be hidden and I would like to be able to move the lines below it upward on the form to fill in the space left by the data field so that no empty space is displayed.

Am I doiing anything wrong ?

Please suggest.

Rashi

Former Member
0 Kudos

i think you're making this way too complicated using a script object.

it's a very simple IF statement

here's another example


if ($.DEFER ne "X") then  
  DeferSub.presence = "hidden"
endif

I'm passing in a value to a field called DEFER. If that Value does not equal X, I'm hiding an enitre subform called DeferSub

This is using Formcalc - in the script editor, there's a dropdown where you can choose between formcalc or javascript.

also, here's a great resource on scripting

http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

Former Member
0 Kudos

Hi Robert,

Thanks for all your help.

My text field is getting hidden now but still lines below it are not moving upwards on the form. Please help me in this also

Rashi

Former Member
0 Kudos

Problem solved.

Rashi

Former Member
0 Kudos

Rashi, Glad you solved it, but it's polite to explain your solution so that others may benefit.

I assume you made your subform "flowed" so that the content will flow upwards when the field is hidden.

Former Member
0 Kudos

Hi Robert,

Yes I made the subform 'FLOWED'....and will keep in mind ur suggestion

Thanks again

Rashi

Answers (0)