PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

Hi, Michelle

This is easy.  Conditional logic basically follows the following syntax:

if (condition) {
        do this;
        do that;
}
else if (other condition) {
        do this;
        do that;
}
else if (other condition) {
        do this;
        do that;
}
else if (other condition) {
        do this;
        do that;
}
else {
        do this;
        do that;
}

The last "else" block executes only if none of the others fire - so it's
good for error messages and the like.

As far as where to put this script, you'll probably want to put it in
the "onMouseup" and in the "onBlur" actions so it fires when people use
the keyboard instead of the mouse.

Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: March 17, 2004 8:24 AM
To: [EMAIL PROTECTED]
Subject: [PDF-Forms] Changing colour of fields dependant on user input
data



PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

Hello,

I wonder if anyone can help.  I have a form with 2 fields which change
depending on what data the user enters - if the user enters 'G' in the
first field I would like the background colour of that field to change
to green and the score of 0 to appear in the second field, similarly if
the user enters 'R' in the first field the background colour should
change to red and the score of 6 to appear in the second field.  ( I
also have two others which are Y = yellow and a score of 4, B = blue and
a score of 10).

I am fairly new to javascript and do not fully understand the if and
else statements, I have tried the following javascript in the mouse up
action tab of the first field and it works but obviously it is only a
small part of the code that I need.  Does anyone know how to do this.

var f = this.getField ("colour_lift");
var f2 = this.getField ("score_lift");

if
(f.value == "G");
{f.fillColor = color.green;
 f2.value = "0";

Any help is much appreciated.

Thank you

Michelle Jennings




************************************************************************
***********
Interested in Occupational health and safety information? Please visit
the HSE website at the following address to keep yourself up to date.

www.hse.gov.uk

************************************************************************
***********


The original of this email was scanned for viruses by the Government
Secure Intranet (GSi) virus scanning service supplied exclusively by
Energis in partnership with MessageLabs.

On leaving the GSi this email was certified virus-free

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html


To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html

Reply via email to