These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Suppressing zeros, kind of....based off two fields?

dooda48
Registered: Apr 28 2008
Posts: 15

Ok guys, another numpty question!

This is (hopefully) the last thing I need to complete a form that I have struggled to finish for a few months now, so hopefully someone can put me out of my misery.

The form has hidden calculations (to get round my lack of knowledge) so don’t laugh at how I have created some of the calcs, but this last one seems to be the simplest thing that I am stuck on.

There is a row of calculations that should only show if Male or Female is selected from the top dropdown. Now I have been able to work out how to make the relevant line appear when selected, but because of the way I have done it I cannot seem to suppress the zeros in the calcs that shouldn’t show until the next ‘Test’ is filled in.

If anyone has time to take a quick look I would really appreciate someone pointing me in the right direction.

Cheers,
Dooda

Files uploaded here:
http://groups.google.com/group/livecycle/web/Measurement%20sheet_22.6.08_new.pdf

My Product Information:
LiveCycle Designer, Windows
StevenD
Registered: Oct 6 2006
Posts: 368
I tried to take a look at the file but it says it is damaged when I try to open it in Acrobat Professional and when I tried to open it in LiveCycle Designer it looks like it isn't a LiveCycle Designer PDF.

If I read you right it sounds like you don't want to have a zero showing in the field where the calculation is suppose to appear. If that is so and you are working in Acrobat you could try this line of JavaScript. Add it as a custom validation script for the field in question.

//Check to see if the field has a calculation of 0 and if it does make the field blank otherwise put the calculated value in.
if(event.value==0) event.value="";

StevenD

dooda48
Registered: Apr 28 2008
Posts: 15
Hi Steve, thanks for the reply.

I just downloaded the file fine from another pc so not sure why its coming up damaged at your end.

I have the little script you suggest in there already, which works perfectly, but when you see the file you will understand what i mean (and see how i have acheived half of the desired result).

I think what i would like the script to do is refer to two fields and if both of those have zeros in to stay blank, rather than just refer to one field.

I am not able to access Livecycle until this evening, but will post the code and hopefully a better description then too.

This is similar to the code; (from Ted Padova's 101)
If i wanted to also add this 'if (f.value !=0)' how would i incorporate this?

1. var f = this.getField("price.0");
2. var g = this.getField("qty.0");
3. if (g.value !=0) // ie add the other field here somehow!
4. event.value = f.value * g.value;
5. else
6. event.value ="";

As you can see this script only relies on one of the fields being zero ( g = qty ), i need both to be filled before showing anything.

Cheers,
Dooda
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
One uses the logical AND check the result of 2 different logical statements.


var f = this.getField("price.0");
var g = this.getField("qty.0");
// test to see if f AND g are both not equal to 0
if ((f != 0) & (g.value != 0) )
event.value = f.value * g.value;
else
event.value ="";

George Kaiser