Difference between revisions of "Documentation/OOo3 User Guides/Writer Guide/Example: a simple form"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
(21 intermediate revisions by 2 users not shown)
Line 20: Line 20:
 
To add these controls:
 
To add these controls:
  
# Select '''View > Toolbars > Form Controls '''to open the Form Control toolbar.
+
<ol><li> Select '''View > Toolbars > Form Controls '''to open the Form Control toolbar.
# If the tools are not active, click the '''Form Navigator''' button (on the Form Control toolbar) to activate them. If necessary, also click the '''Design Mode On/Off''' button.
+
<li> If the tools are not active, click the '''Design Mode On/Off''' [[Image:CH15_DesignModeONOFF.png]] button to activate them.
# Click the Text Box button [[Image:FormTextbox.png]], then click in the document and, with the left mouse button held down, drag the shape of the Name text box to approximately the size you want.  
+
<li> Click the Text Box button [[Image:FormTextbox.png]], then click in the document and, with the left mouse button held down, drag the shape of the Name text box to approximately the size you want.  
# Make sure the '''Wizards On/Off''' button [[Image:FormWizardsIcon.png]] is on (shaded with a border). Click the More Controls button [[Image:FormMoreControls.png]] to launch the More Controls toolbar.
+
<li> Make sure the '''Wizards On/Off''' button [[Image:FormWizardsIcon.png]] is on (shaded with a border). Click the More Controls button [[Image:FormMoreControls.png]] to launch the More Controls toolbar.
# On the More Controls toolbar, click the Group Box button [[Image:FormGroupBox.png]]. Draw a group box by the Sex: entry to launch the Group Element Wizard.
+
<li> On the More Controls toolbar, click the Group Box button [[Image:FormGroupBox.png]]. Draw a group box by the Sex: entry. The Group Element Wizard opens.
# On the first page of the wizard, enter two names for the options fields: Male and Female. Click '''Next>>''' three times, delete the caption and click '''Finish'''.
+
<Blockquote>
# Now create the list box. On the Form Controls toolbar, click the '''Wizards On/Off''' button [[Image:ormWizardsIcon.png]] to turn wizards off. Click the '''List Box''' button [[Image:FormListbox.png]] and draw a list box by Favourite Shape: in the document. This will just be an empty pane for now.
+
<ol style="list-style-type:lower-alpha">
# Finally create four check boxes by All the shapes you like. Click on the '''Check Box''' button [[Image:FormCheckbox.png]] and then draw out four check boxes, side by side across the page.
+
<li value= "a"> On the first page of the wizard, enter two names for the options fields: Male and Female. Click '''>>''' after each entry. Click '''Next>>'''.
  
You should now have a document looking something like the figure below.
+
[[Image:CH12_GroupElementWizard_Data.png|thumb|none|500px|''Specifying names for option fields.'']]
  
[[Image:WG15-4.png|thumb|none|500px|''Document with form controls.'']]
+
<li> On the next page, select the option ''No, one particular field is not going to be selected''. Click '''Next>>'''.
 +
 
 +
[[Image:CH15_GroupElementWizard_DefaultFieldSelection.png|thumb|none|500px|''Selecting a default field.'']]
 +
 
 +
<li> Give a value to your fields. Typically, you would give one field the value 1 and the other field the value 2. If there are more than 2 option fields, you would give them values of 3, 4, and so on. Click '''Next >>'''.
 +
 
 +
[[Image:CH15_GroupElementWizard_FieldValues.png|thumb|none|500px|''Assigning field values.'']]
 +
 
 +
<li> You can either delete the caption or give a caption to your Group Box. Then click '''Finish'''.
 +
 
 +
[[Image:CH15_GroupElementWizard_CreateCaption.png|thumb|none|500px|''Create Caption Option.'']]
 +
 
 +
</li></ol>
 +
</Blockquote>
 +
 
 +
<li value= "6"> Now create the list box. On the Form Controls toolbar, click the '''Wizards On/Off''' button [[Image:CH15_WizardONOFF.png]] to turn wizards off. Click the '''List Box''' button [[Image:CH15_ListBoxIcon.png]] and draw a list box by Favourite Shape: in the document. This will just be an empty pane for now.
 +
 
 +
<li> Finally create four check boxes by All the shapes you like. Click on the '''Check Box''' button [[Image:CH15_CheckBoxIcon.png]] and then draw out four check boxes, side by side across the page.
 +
 
 +
</li></ol>
 +
 
 +
:  You should now have a document looking something like the figure below.
 +
 
 +
: [[Image:WG15-4.png|thumb|none|500px|''Document with form controls.'']]
  
 
== Configure form controls ==
 
== Configure form controls ==
No further configuration is required to the Name and Sex fields (though, of course, there is configuration that could be done if you wanted, such as giving a name to each control and changing the appearance of the controls).
+
No further configuration is required to the Name and Sex fields, but you could, if you wish, give a name to each control and change the appearance of the controls.
 +
 
 +
The list box must be configured to add the list of options. The check boxes must be configured to add in the names (instead of Check Box, Check Box1, and so forth). Following are instructions to configure these controls:
 +
 
 +
<ol><li> Be sure design mode is on. Double-click on the List Box control within the document to open the control’s Properties dialog box. Select the ''General'' tab.
 +
<li> In the List Entries box (scroll down if it is not visible), type the names of the shapes (Circle, Triangle, Square, Pentagon) separated by ”;” and then press ''Enter''. You should end up with a line saying “<tt>Circle</tt>”;”<tt>Triangle</tt>”;”<tt>Square</tt>”;”<tt>Pentagon</tt>”.
 +
 
 +
[[Image:CH15_Properties_ListBox.png|thumb|none|500px|''Properties dialog box for a list box.'']]
 +
 
 +
<li> Click on the first Check Box. The Properties dialog box stays open but changes to show the properties for the check box.
 +
 
 +
[[Image:CH15_Properties_CheckBox.png|thumb|none|500px|''Top part of Properties dialog box for a
 +
check box.'']]
 +
 
 +
<li> Change the ''Label'' field from Check Box to Circle and press ''Enter''. The cursor moves to ''Label Field'' and the label on the check box in the document changes immediately.
 +
 
 +
<li> Click on each of the other three check boxes in turn. Change the Label in the Properties dialog box to Triangle, Square, and
 +
Pentagon in turn.
  
The list box must be configured to add the list of options. The check boxes must be configured to add in the names (instead of Check Box, Check Box1...)
+
<li> Close the Properties dialog box.
  
# Click on the List Box control within the document and then the Control button [[Image:]] on the Form Design toolbar to launch the control properties dialog box. Select the General tab.
+
<li> Turn design mode off [[Image:CH15_DesignModeONOFF.png]] and close the two Controls toolbars.
# In the List Entries box, enter the names of the shapes: Circle, Triangle, Square and Pentagon. Type in one shape and press Enter. Then position the cursor at the end of the line to type in the next shape. You should end up with a line saying “Circle”;”Triangle”;”Square”;”Pentagon”.
+
# Click on the first Check Box. The Properties dialog box stays open but changes to show the properties for the check box.
+
# Change the Label to Circle and press ''Enter''. The label on the check box will change immediately.
+
# Click on each of the other three check boxes in turn. Change the Label in the Properties dialog box to Triangle, Square and Pentagon in turn.
+
# Close the Properties dialog box.
+
# Turn Design Mode off [[Image:FormDesignOffIcon.png]] and close the two Controls toolbars.
+
  
 
You have now completed the form and your form hopefully looks something like the figure below.
 
You have now completed the form and your form hopefully looks something like the figure below.
Line 55: Line 89:
 
To make the document read-only, select '''Tools > Options > OpenOffice.org > Security > Open this document in read-only mode'''.
 
To make the document read-only, select '''Tools > Options > OpenOffice.org > Security > Open this document in read-only mode'''.
  
{{Documentation/Note| If the document is read-only, anyone filling in the form will need to use '''File > Save as '''to save the document.}}
+
{{Note| If the document is read-only, anyone filling in the form will need to use '''File > Save as '''to save the document.}}
  
  
 
{{CCBY}}
 
{{CCBY}}
 
[[Category: Writer Guide (Documentation)]]
 
[[Category: Writer Guide (Documentation)]]

Latest revision as of 18:57, 6 July 2018


Create the document

Open a new document (File > New > Text Document). It is a good idea to write down the outline of the document, without form controls, though of course it can easily be changed later.

Initial document without form controls.

Add form controls

The next step is to add the form controls to the document. We will have four controls:

  • Name is a text box
  • Sex is two option buttons, male or female.
  • Favourite shape is a list of options.
  • All shapes you like is a series of check boxes.

To add these controls:

  1. Select View > Toolbars > Form Controls to open the Form Control toolbar.
  2. If the tools are not active, click the Design Mode On/Off CH15 DesignModeONOFF.png button to activate them.
  3. Click the Text Box button FormTextbox.png, then click in the document and, with the left mouse button held down, drag the shape of the Name text box to approximately the size you want.
  4. Make sure the Wizards On/Off button FormWizardsIcon.png is on (shaded with a border). Click the More Controls button FormMoreControls.png to launch the More Controls toolbar.
  5. On the More Controls toolbar, click the Group Box button FormGroupBox.png. Draw a group box by the Sex: entry. The Group Element Wizard opens.
    1. On the first page of the wizard, enter two names for the options fields: Male and Female. Click >> after each entry. Click Next>>.
      Specifying names for option fields.
    2. On the next page, select the option No, one particular field is not going to be selected. Click Next>>.
      Selecting a default field.
    3. Give a value to your fields. Typically, you would give one field the value 1 and the other field the value 2. If there are more than 2 option fields, you would give them values of 3, 4, and so on. Click Next >>.
      Assigning field values.
    4. You can either delete the caption or give a caption to your Group Box. Then click Finish.
      Create Caption Option.
  6. Now create the list box. On the Form Controls toolbar, click the Wizards On/Off button CH15 WizardONOFF.png to turn wizards off. Click the List Box button CH15 ListBoxIcon.png and draw a list box by Favourite Shape: in the document. This will just be an empty pane for now.
  7. Finally create four check boxes by All the shapes you like. Click on the Check Box button CH15 CheckBoxIcon.png and then draw out four check boxes, side by side across the page.
You should now have a document looking something like the figure below.
Document with form controls.

Configure form controls

No further configuration is required to the Name and Sex fields, but you could, if you wish, give a name to each control and change the appearance of the controls.

The list box must be configured to add the list of options. The check boxes must be configured to add in the names (instead of Check Box, Check Box1, and so forth). Following are instructions to configure these controls:

  1. Be sure design mode is on. Double-click on the List Box control within the document to open the control’s Properties dialog box. Select the General tab.
  2. In the List Entries box (scroll down if it is not visible), type the names of the shapes (Circle, Triangle, Square, Pentagon) separated by ”;” and then press Enter. You should end up with a line saying “Circle”;”Triangle”;”Square”;”Pentagon”.
    Properties dialog box for a list box.
  3. Click on the first Check Box. The Properties dialog box stays open but changes to show the properties for the check box.
    Top part of Properties dialog box for a check box.
  4. Change the Label field from Check Box to Circle and press Enter. The cursor moves to Label Field and the label on the check box in the document changes immediately.
  5. Click on each of the other three check boxes in turn. Change the Label in the Properties dialog box to Triangle, Square, and Pentagon in turn.
  6. Close the Properties dialog box.
  7. Turn design mode off CH15 DesignModeONOFF.png and close the two Controls toolbars. You have now completed the form and your form hopefully looks something like the figure below.
    Completed form.

    Finishing touches

    The form is complete, but you are free to make further changes to the document. If you were sending this out to other people to complete, you would probably want to make the document read-only. The effect would be that users would be able to fill in the form, but not to make any other changes to the document.

    To make the document read-only, select Tools > Options > OpenOffice.org > Security > Open this document in read-only mode.

    Documentation note.png If the document is read-only, anyone filling in the form will need to use File > Save as to save the document.


    Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools