Difference between revisions of "How to simulate Radio Buttons on PDF forms"

From Scribus Wiki
Jump to: navigation, search
(The method by example)
(The method by example)
Line 17: Line 17:
 
On your form, create two or more Check Boxes and use a Text Frame to label each with suitable text.  
 
On your form, create two or more Check Boxes and use a Text Frame to label each with suitable text.  
  
Each Check Box should also have a suitable name to reflect the answer.  
+
Each Check Box should also have a suitable name to reflect the purpose.  
  
In this example we will have three Check Boxes called '''“Yes”, “No”, “Maybe”''' and three Text Frames containing '''“Yes”, “No”, “Maybe”.'''  
+
[[In this example]] we will have three Check Boxes called '''“Yes”, “No”, “Maybe”''' and three Text Frames containing '''“Yes”, “No”, “Maybe”.'''  
  
 
Take care when naming and using JavaScript as Acrobat is case sensitive.
 
Take care when naming and using JavaScript as Acrobat is case sensitive.
  
 
You should end up with something like this on your page.
 
You should end up with something like this on your page.
 +
 +
[[Image:Scribusform.JPG]]
 
   
 
   
 
Right click with your mouse on the '''“Yes” Check Box''' (Blue Square)
 
Right click with your mouse on the '''“Yes” Check Box''' (Blue Square)
Line 47: Line 49:
 
You should have the following displayed.
 
You should have the following displayed.
  
 +
 +
[[Image:Fieldproperties.JPG]]
 
   
 
   
  
Line 69: Line 73:
  
 
You should have the following which functions like Radio Buttons.
 
You should have the following which functions like Radio Buttons.
 +
 +
[[Image:Pdf.JPG]]

Revision as of 04:28, 30 May 2007

Introduction

(From Wikipedia, the free encyclopedia) A radio button or option button (sometimes improperly referenced as "radial button") is a type of graphical user interface widget that allows the user to choose one of a predefined set of options. Radio buttons are arranged in groups of two or more and displayed on screen as, for example, a list of circular holes that can contain white space (for unselected) or a dot (for selected). Adjacent to each radio button is normally shown a caption describing the choice that this radio button represents. When the user selects a radio button, any previously selected radio button in the same group becomes deselected. Selecting a radio button is done by clicking the mouse on the button, or the caption, or by using a keyboard shortcut.

Currently Scribus is unable to create radio buttons on pdf forms as the Adobe technique for creating Radio Button Objects is for a group to all have the same name. Scribus does not allow objects to have the same name.

Fortunately, a group of Check Boxes containing a little java script in each can be used to simulate a group of Radio Buttons.

The method by example

Select the “Check Box” from the pdf fields on the tool bar.

Checkbox.JPG

On your form, create two or more Check Boxes and use a Text Frame to label each with suitable text.

Each Check Box should also have a suitable name to reflect the purpose.

In this example we will have three Check Boxes called “Yes”, “No”, “Maybe” and three Text Frames containing “Yes”, “No”, “Maybe”.

Take care when naming and using JavaScript as Acrobat is case sensitive.

You should end up with something like this on your page.

Scribusform.JPG

Right click with your mouse on the “Yes” Check Box (Blue Square)

A menu pops up and select PDF Options –> Field Properties

Next select the Action Tab –> choose JavaScript and then use the default Mouse Up event -

Click on Edit and insert the following

//this.getField("Yes").value = "Off"

this.getField("No").value = "Off"

this.getField("Maybe").value = "Off"

Note the // means the first line is commented out.

This makes it easy to Copy and Paste the complete code to all the Check Boxes.

Click on Save and Exit.

You should have the following displayed.


Fieldproperties.JPG


In the “No” Check Box, repeat the process with

this.getField("Yes").value = "Off"

//this.getField("No").value = "Off"

this.getField("Maybe").value = "Off"


and then with the “Maybe” Check Box

this.getField("Yes").value = "Off"

this.getField("No").value = "Off"

//this.getField("Maybe").value = "Off"

Now save your document as a PDF and view the PDF file using Adobe Acrobat Reader.

You should have the following which functions like Radio Buttons.

Pdf.JPG