Building a data entry form
Part
1: Building a simple form
Part
2: Introducing validation
See also: Tutorial Building a form
with Database Integration,
Tutorial
– Build a Form Using Tables,
Tutorial
– Using XML and Web Services,
Controls,
Layouts, Form Editor
This document will lead you step by step through the process
of building and testing a form with Ebase, and will familiarize you with
working with the Ebase Designer.
In this exercise, we will create a simple one-page form. We
will pretend this is to be used by the film industry to collect nominations for
the annual Oscars event. Note, if you have a problem at any time, enter Ctrl Z
to undo the most recent change.
Create a form and place fields on the page.
Hint: if you can’t see the form header
text, check the Toggle Designer View icon on the WYSIWYG View toolbar – this icon should
be depressed. If you still don’t see a form header text, click on the Form
Properties icon
on the form toolbar (top of the page), select
the Presentation tab, and check that
option Display form header in the Form Header Panel section is set.
Hint: when
dragging/dropping controls, you can drop them in either the WYSIWYG View or the
Outline View.
Field
Name |
Field
Type |
Display Type |
NOMINEE |
Character |
Text |
AWARD |
Character |
Dropdown |
REASONS |
Character |
Textarea |
Let the Field data length and label text columns in the wizard take default values. Click OK to add the new fields.
Hint: To change the display type or field type, just click in the table cell and a dropdown list will be displayed.
Note that for each field added, both
a Field and a Field Control have been created. A Field is a form-level element that is available for display on any
page - Fields are shown in the Fields View. A Field Control represents the display of a field on a specific page,
and each Field Control is linked to an underlying Field - Field Controls are shown in both the Outline View and the
WYSIWYG View on the pages where they appear. Ebase is a little unusual in that
many presentation properties are configured on the Field, not on the Field
Control where you might expect to find them; this includes Display Type: Text, Dropdown, Textarea, Checkbox etc, Display
Length, plus other presentational properties.
8.
We
will now add the second Group Panel Control after the first one. To do this,
drag another Group Panel Control from the Palette and drop it onto the first
Group Panel Control in the Outline View;
the black line showing the drop location should be underneath the control icon – to indicate drop after as opposed to drop inside.
Hint: we could alternatively have used the WYSIWYG
View to do this: drag the new control over the group header text of the first
Group Panel Control; a small blue box is displayed at the top left of the
control – with the left mouse still held down, move the mouse pointer over this
box which then pops up a control tree panel showing all parent controls. Drop
the new control after the first Group Panel Control as described above.
Field
Name |
Field
Type |
Display Type |
NAME |
Character |
Text |
ADDRESS |
Character |
Textarea |
POSTCODE |
Character |
Text |
|
Character |
Text |
As before, let the Field data length and label text columns in the wizard take default values.
At this point, the page should look like this:
Try running the
form to see how it looks in a browser – click the run icon on
the main form toolbar. You will notice a few differences; this is
because the WYSIWYG View adds a number of things e.g. indicators for empty texts,
to make page design easier. You can see how a page will truly appear at anytime
by clicking the Toggle designer view icon
on the WYSIWYG View toolbar. This is a
toggle switch so clicking it again returns to the assisted display.
Note: in the browser, there
is no data entry field opposite the 'Award'
text. This is because we have declared the AWARD field as a dropdown list but
have not yet told the system which values to display in the list. We’ll fix
this in a moment.
We will now make some of the fields mandatory.
Hint: clicking the help icon at the top of the Properties View displays the
help page for the properties currently being displayed. You can also press the
F1 key from any point in the Form Editor to get local help on the element
currently in focus.
Hint: You can also do this
in one operation by holding down the CTRL key to select multiple Field Controls
and then right clicking and selecting Set
Mandatory.
Now we have the basic form, we can set about enhancing it.
16. Create
a dropdown list of awards by first creating a static list of award values and associating the list with the AWARD
field:
·
From the file menu select (File -> New
-> List -> Static List) to open the static list editor
·
Enter oscar_awards
as the name of the list.
·
Enter values in the list by clicking the Add
static list item icon and enter the following details:
Language |
Display Seq |
Text |
Return Value |
English |
1 |
Best Actor |
A |
English |
2 |
Best Director |
B |
English |
3 |
Best Supporting Actor |
C |
English |
4 |
Best Music Score |
D |
·
Click the Save icon (this static list can now be used by any form)
·
Click on the OSCARS form in the open
items panel at the top of the screen to return to the form editor (or double
click on the OSCARS form icon in
the tree)
·
Click on the AWARD field in the Fields View –
its properties are displayed in the Properties View. Click on the Static List
property in section Lists and select
OSCAR_AWARDS from the dropdown.
Add some
texts:
Welcome to the new
democratic
Supplying your email
enters you in our fabulous holiday for two at the Hollywood Oscars competition.
Hint: If you use
the Outline View as the target for the drop, hover the mouse over the icon of the EMAIL Field Control – this
indicates add after the control as opposed to add
to.
Add some
styling:
These styling properties can either be local values or linked from a Property Set in the form’s Presentation Template.
Tweak the presentation.
None of the fields in the OSCARS form have any obvious
need for validation, so we will introduce a new field. We will ask our users
whether they work in the film industry, and if they do, we will issue an error
message saying they can't make a nomination.
Add a new field WORK_IN_INDUSTRY after the NAME
field:
·
Display
Type (Section Presentation) to
Checkbox
·
Field
Type (Section General) to Boolean
·
Label
Text (Section Texts) to "Do you
work in the film industry?"
Add a validation check to run against this field:
Run the form and verify that it works as expected:
In this example, we have used the script builder wizard to generate a simple script. In practice, you are more likely to create a new script to add whatever programming logic you require and then add this to an event. See Server-side Programming for details of available scripting languages.
That completes this tutorial. There are still quite a few things
we need to do to make this into a working application – perhaps the most
obvious is to add some programming logic to the Submit Application button to
collect the details entered and then do something with this information –
typically this would be one or more of: writing to a database, calling a web
service, sending an email. These subjects are explored further in other
tutorials (see the links at the top of this page).