Previous | Next | (P-PDF) Developers
Topic: create two slide buttons
Conf: (P-PDF) Developers, Msg: 32101
From: Jub
Date: 12/31/2001 03:09 AM
OK - it sound like the fields are readonly and you just want to make one of them visible at any one time.
Which is easier!
Below is a simple script to do this.
It assumes that the fields are named
"field1"
"field2"
"field3"
etc
If you don't have this naming convention, don't worry, you'll just have to change the variables or logic a bit.
Set the script up as a Document Level Function, and call it from the MouseUp event of BOTH of your Forward and Back buttons.
Let me know if you have any problems.
Jub
function ForwardBack()
{
var ForwardButtonName = "Forward";
var BackButtonName = "Back";
var NumOfFields = 10;
var FieldNameRoot = "field";
var ActiveField = 0;
var CallingButtonName = event.target.name;
for(var x = 1; x <= NumOfFields; x++)
{
var Field = this.getField(FieldNameRoot + String(x));
if(Field.display == display.visible)
{
ActiveField = x;
break;
}
}
/* we now know which field is active - make the next field visible */
if(CallingButtonName == ForwardButtonName && ActiveField < NumOfFields)
{
var NextNumber = x+1;
var NextFieldName = FieldNameRoot + String(NextNumber);
var NextField = this.getField(NextFieldName);
NextField.display = display.visible;
var CurrentField = this.getField(FieldNameRoot + String(x));
CurrentField.display = display.hidden;
}
else if(CallingButtonName == BackButtonName && ActiveField > 1)
{
var NextNumber = x-1;
var NextFieldName = FieldNameRoot + String(NextNumber);
var NextField = this.getField(NextFieldName);
NextField.display = display.visible;
var CurrentField = this.getField(FieldNameRoot + String(x));
CurrentField.display = display.hidden;
}
}