cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide the entire field (even the caption) when the variable value is

jitendra_mehta
Participant
0 Kudos

I have defined a text field with text caption in ADOBE form.

How do I hide the entire field (even the caption) when the variable value is blank?

I have the tried the formcalc script (form:ready event) at subform level like following:

if ( $.VAR1 == " " ) then

$.VAR1.presence = "hidden"

endif

But it doesn't hide the text caption.

Thanks.

Jitendra Mehta

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Is this a print form or Interactive form? Also try the following code in JavaScript

if (VAR1.rawValue == "" ||  VAR1.rawValue == null) 
{
   VAR1.presence = "hidden";
}
else
{
  VAR1.presence = "visible";
}

Chintan

jitendra_mehta
Participant
0 Kudos

Hi Chintan:

It is just a print form, not the interactive form.

Thanks.

jitendra_mehta
Participant
0 Kudos

Hi Chintan:

Thanks. I tried your logic in Javascript as well as in formcalc ( "||" to be replaced by "or" ) and it works in both.

On further efforts, I found that the logic just needs to check the value as "null" and indeed we have to check parameter .rawValue to make it work.

Thanks again. It works like a charm.

Hi Otto:

Thanks for your answers too. Since the above logic worked, I did not dig further into the OSS note you referred. But I really appreciate your help.

Former Member
0 Kudos

Hello,

i am facing the same problem and have used below code as formcalc in server and client but it is not working for me.

Event is form ready;

if ($record.GV_AMT_PAYABLE_COMP.rawValue == "" or $record.GV_AMT_PAYABLE_COMP.rawValue == null)

{

GV_AMT_PAYABLE_COMP.presence = "hidden";

}

else

{

GV_AMT_PAYABLE_COMP.presence = "visible";

}

Thanks for your helps in advance.

Regards

Beserithan

Answers (2)

Answers (2)

OttoGold
Active Contributor
0 Kudos

1) you mix up formcalc and javascript, I think

2) you´re not welcomed here because you don´t have a single point and keep asking. You have never helped a living soul thus nobody is going to help yoiu around here. Please fix this and we can come back to your problems. Otto

OttoGold
Active Contributor
0 Kudos

Hello,

I can recommend you to use simple debug messages to see what the value is on runtime. Maybe you would be surprised and confused about the result:)) Use "app.aler(yourvariable.rawvalue)" in JavaScript coding to get the message box, note: it is double p like application, but I am not allowed to write it in the post, same with the a-l-e-r-t.

Sometimes nothing means a SPACE character, sometimes "" (like really nothing = string size 0), sometimes NULL. Play with that for a moment (do that in a LCD only on your desktop, not in SAP, to spare some time).

Regards, Otto

jitendra_mehta
Participant
0 Kudos

Hi Otto:

I must confess I don't have a very good depth of knowledge using Javascript or its functions.

I assume we have to use the script at the subform level (under which the field is kept) and that we use the script at event form:ready, correct?

I have tried them at form:ready as well as at event form:initialize but to no avail.

Thanks.

OttoGold
Active Contributor
0 Kudos

I don´t like this scripting too, but sometimes it is a must to use it.

Yes, put the script on subform, you can try more than one event (not at once) to find the proper one. I would use initialize event. Or maybe try the layout:ready event.

I guess you´ll need your form to be dynamic. Please check that, it is a prerequisition to make the layout changes work.

If such a note has not been applied yet, please search for the note which fixes the bug in dynamic but not fillable forms. I think it is no: 1319176.

Regards, Otto