Forms: Difference between revisions

From nuBuilderForte
Jump to navigation Jump to search
No edit summary
 
(167 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The first thing you will see after logging into nuBuilder Forte is a nuBuilder Launch Form (also referred to as the Home Page).
Back to [[Documentation]]


This is a special type of Form, which in this case, contains Button Objects that will take you to other Forms.
== What is a Form? ==
The first thing you will see after logging into nuBuilder Forte (as a '''user''' and ''not'' a '''globeadmin''') is a nuBuilder Launch Form containing Button Objects that will take you to other Forms.
 
This is also referred to as a Home Page (User Home).
 
=== Form Types ===
There are 5 types of Forms.
 
#Browse - A selectable list of records from a database table used by [[Objects#Tab_-_Lookup|Lookup Objects]].
#Edit - An area displaying editable fields from a record in a database table.
#Browse and Edit - A Form to select and then edit a record in a database table.
#Subform - An Edit Form that is repeated inside a Subform Object.
#Launch - A Form not associated with a database table.
 
 
<div style='background-color:#D8E4FF;padding:10px'>
A '''Browse''' is used by a [[Objects#Tab_-_Lookup|Lookup Object]] to select a record from another table.
</div>
 
* Temporary tables are just used to display data in a Browse Form and is deleted again after it has loaded. They generally are prefixes and suffixed by two underscores with a random string in between like <tt>___nu16019b9e97b815___</tt>.
 
=== Building a Form ===
 
You can build a Form (and create a [[Objects#Tab_-_Run|Button]] to Access that Form) the '''easy way''' using the [[Form Builder]].
 
OR...
 
You can create a new Form the '''long way''' by...


Creating a new Form can be done by
#Clicking the Form Button on the Setup Tab of the Home Page.
#Clicking the Form Button on the Setup Tab of the Home Page.
#Clicking the Add Button at the top of its Browse Form.
#Clicking the Add Button at the top of a Browse Form.
#Filling out the new Form's properties (see below).
#Filling out your new Form's properties (see below). We suggest you make your first Form a [[Forms#Form_Type|Browse and Edit]].
#Clicking the Save Button at the top of its Edit Form.
#Clicking the Save Button at the top of its Edit Form.
#Now you'll want to add some [[Objects]] to your new Form.
#You will need to add a [[Objects#Tab_-_Run|Button]] to the Home Page so users can open it.
#And then you'll want to add some [[Objects]] to your new Edit Form, for displaying and editing fields.
 
== Note ==
* To open a Launch Form, the Record Id has to be -1 , otherwise the Form won't open properly.
* This is not necessarily intuitive, therefore it has been changed in v4.5 so that the Launch form also opens correctly even if the Record ID is left blank.
* For backward compatibility, '''-1''' is still accepted in v4.5.
* [[Media:nulaunch-blank_compat.png|Screenshot]]
* [[Media:FilterForm.png|Filter Form Screenshot]]
 
=Form Properties=
 
==Form Type==
 
Choose 1 of the following.
*Browse - Used by a Lookup Object.
*Edit - Used to display editable fields from a record in a database table.
*Browse and Edit - Used to find a record and then display it.
*Subform - Used inside a Subform Object.
*Launch Used...
**As a Home Page
**A Form to display other nuBuilder Objects
**For adding criteria to a Report.
 
==Code==
A unique code of alphanumeric characters.
 
==Description==
A short description of the purpose of this Form.
 
==BreadcrumbTitle==
If left blank, the Breadcrumb that appears on the Form will be the same as the '''Description'''.
 
 
If filled in, it can customise the breadcrumb using Hash Cookies and a '|'.
 
 
The Hash Cookies can be valid field names from the Table on this Form and anything after the '|' will appear for New records.
 
eg...
  #com_code# - #com_name#|New Company
Would return something like this for current records...
  AP - Apex Cleaners
Or if was a new record it would return this...
  New Company
 
==Table Name==
The database table containing records and fields to display.
 
This is not required for Launch Forms.
 
==Primary Key==
The Primary Key that belongs to the selected Table.
 
This is not required for Launch Forms.
 
==Mobile View==
If enabled, a Form is rendered in a mobile device-friendly view.
 
 
This mobile-friendly view positions all Objects on a Form in one long row grouped by the Tab Titles, with each Object having its Object Title above it.
 
 
This makes it easier to navigate on a mobile device




==Form Properties==
'''Please note''' : The global switch ''nuMobileView'' in either nuconfig.php or Setup-> Settings has to be set to true.


===Form Type===
==Tabs (Subform)==
Choose 1 of the following 5 types.
All Form types, apart from '''Browse''' Forms, require at least one Tab.
*<span style="padding:4px 6px 4px 2px;background:#cbc287">Browse</span> A grid like table, with seachable fields and sortable columns. Designed to easily select a record from a database table or query.
*<span style="padding:4px 6px 4px 2px;background:#68c994">Edit</span> A Form displaying editable fields (nuBuilder Objects). Generally from a choice made on its previous Browse Form.
*<span style="padding:4px 6px 4px 2px;background:#a0a7d6">Browse and Edit</span> A Form with properties to define both Browse and Edit.
*<span style="padding:4px 6px 4px 2px;background:#dd6eb3">Launch</span> Not associated with a database table. Used to launch other Forms or hold editable values for Launching a Report or Procedure.
*<span style="padding:4px 6px 4px 2px;background:#fa9b96">Subform</span> An editable Form that is repeated inside a Subform Object, generally linking its records to that of the main Edit Form.


===Code===
Tabs are arranged horizontally above the editable area of an Edit Form.
A Unique Code of alphanumeric characters.
===Description===
Its Description.


===Table Name===
Tabs allow users to navigate (what seems like) different layers on the same Form.
Database table containing records to display.
Not required for Launch Forms.


===Primary Key===
===Title===
Primary Key belonging to Selected Table.
Not required for Launch Forms.
===Tabs===
====Title====
Tab Title
Tab Title
====Order====
===Order===
Displayed order of Tab.
Displayed order of the Tabs. - Every time the Form is saved these records this will be reordered and renumbered in multiples of 10.
===SQL===
===Help===
SQL used to display records a Browse Form or the order of a Subform.
JavaScript that can run to help the user eg. ''window.open('www.nubuilder.com')'' or ''nuMessage(['You must fill in','all fields.']);''
===Columns===
 
====Title====
==SQL==
Column Title
If you want any help building SQL, the SQL Button will direct you to nuBuilder's [[SQL Builder]].
====Display====
 
Table field name.
 
====Align====
This SQL is used to display records on a Browse Form from either...
Left or Right or Center
 
====Format====
An normal SQL Statement eg...
Used for formatting dates and numbers. - Formatted results are not searchable.
 
====Width====
  SELECT * FROM customer
Width of column.
 
====Order====
Or an SQL statement that can reference a complicated temporary table created with [[#Building_a_Procedure|PHP]] using a [[Hash_Cookies|Hash Cookie]]...
Order of column.
 
===Row Height===
  SELECT * FROM #TABLE_ID#
Height in pixels
 
===Rows Per Page===
 
Height in pixels
OR
===Redirect To===
 
Open with different Edit Form if required.
Used by Subform Objects to order records inside the Subform.
 
* Subform Foreign key by default appears in Fast Form (Subform type) when the subform table is absent and needs to be created. This can be altered by removing the [[Media:subform_fk.png|marked part of the nuSetFK() function]] (in case it does not yet exist) attached to the field <tt>zzzzsys_form.sfo_javascript</tt> in its '''custom code'''.
 
==Columns (Subform)==
===Title===
The title of this column, which will appear at the head of the column.
===Display===
The column of the database that is to be displayed in this column.
 
SQL formatting functions can be applied to the column as shown in Example 2.
 
Example 1. <code> cus_name </code>
 
Example 2. <code> DATE_FORMAT(inv_date,'%m-%d-%Y') </code>
===Align===
How the text within the column are aligned. The choices are: Left, Right or Center
===Format===
Used for formatting dates and numbers - The Formatted part of results are not searchable. (Don't search for a '''$''' if it's not in the actual record.)
 
===Width===
The width of the Column in pixels.
===Order===
Order of column. - Every time the Form is saved these records this will be reordered and renumbered in multiples of 10.
 
==Row Height==
Height in pixels of each of the Rows in the Browse Form. If left blank this will default to 18px.
 
==Rows Per Page==
 
The maximum number of rows that are displayed on a Browse Page. The remaining rows are displayed on a separate page.<br>
(If left blank this will default to 25 rows)
 
==Redirect To==
 
Redirects the choice made this a Browse Form to another Edit Form.
 
==PHP Code==
PHP code can be added at the following places on a Form.
 
*'''BB''' - Before Browse
*'''BE''' - Before Edit - not available in Subform Forms.
*'''BS''' - Before Save - not available in Subform or Launch Forms.
*'''AS''' - After Save - not available in Subform or Launch Forms.
*'''BD''' - Before Delete - not available in Subform or Launch Forms.
*'''AD''' - After Delete - not available in Subform or Launch Forms.
 
 
These sections are explained in the flowchart below.
 
==JavaScript==
 
A Textarea containing JavaScript code - not available in Subform Forms.
 
To edit this, double click on the Textarea and you will open [[Ace Editor]] in a full screen.
 
This JavaScript can be used on all Forms except for Subforms.


===PHP Code===
PHP code can be added on these events..
*Before Browse
*Before Edit
*Before Save
*After Save
*Before Delete
*After Delete


===Javascript===
'''JS''' in the flowchart below.
Javascript to be run on all Forms except Subform Forms.
[[File:EventFlow.PNG|1000px|Click to view larger]]

Latest revision as of 21:49, 11 April 2023

Back to Documentation

What is a Form?

The first thing you will see after logging into nuBuilder Forte (as a user and not a globeadmin) is a nuBuilder Launch Form containing Button Objects that will take you to other Forms.

This is also referred to as a Home Page (User Home).

Form Types

There are 5 types of Forms.

  1. Browse - A selectable list of records from a database table used by Lookup Objects.
  2. Edit - An area displaying editable fields from a record in a database table.
  3. Browse and Edit - A Form to select and then edit a record in a database table.
  4. Subform - An Edit Form that is repeated inside a Subform Object.
  5. Launch - A Form not associated with a database table.


A Browse is used by a Lookup Object to select a record from another table.

  • Temporary tables are just used to display data in a Browse Form and is deleted again after it has loaded. They generally are prefixes and suffixed by two underscores with a random string in between like ___nu16019b9e97b815___.

Building a Form

You can build a Form (and create a Button to Access that Form) the easy way using the Form Builder.

OR...

You can create a new Form the long way by...

  1. Clicking the Form Button on the Setup Tab of the Home Page.
  2. Clicking the Add Button at the top of a Browse Form.
  3. Filling out your new Form's properties (see below). We suggest you make your first Form a Browse and Edit.
  4. Clicking the Save Button at the top of its Edit Form.
  5. You will need to add a Button to the Home Page so users can open it.
  6. And then you'll want to add some Objects to your new Edit Form, for displaying and editing fields.

Note

  • To open a Launch Form, the Record Id has to be -1 , otherwise the Form won't open properly.
  • This is not necessarily intuitive, therefore it has been changed in v4.5 so that the Launch form also opens correctly even if the Record ID is left blank.
  • For backward compatibility, -1 is still accepted in v4.5.
  • Screenshot
  • Filter Form Screenshot

Form Properties

Form Type

Choose 1 of the following.

  • Browse - Used by a Lookup Object.
  • Edit - Used to display editable fields from a record in a database table.
  • Browse and Edit - Used to find a record and then display it.
  • Subform - Used inside a Subform Object.
  • Launch Used...
    • As a Home Page
    • A Form to display other nuBuilder Objects
    • For adding criteria to a Report.

Code

A unique code of alphanumeric characters.

Description

A short description of the purpose of this Form.

BreadcrumbTitle

If left blank, the Breadcrumb that appears on the Form will be the same as the Description.


If filled in, it can customise the breadcrumb using Hash Cookies and a '|'.


The Hash Cookies can be valid field names from the Table on this Form and anything after the '|' will appear for New records.

eg...

  #com_code# - #com_name#|New Company

Would return something like this for current records...

  AP - Apex Cleaners

Or if was a new record it would return this...

  New Company

Table Name

The database table containing records and fields to display.

This is not required for Launch Forms.

Primary Key

The Primary Key that belongs to the selected Table.

This is not required for Launch Forms.

Mobile View

If enabled, a Form is rendered in a mobile device-friendly view.


This mobile-friendly view positions all Objects on a Form in one long row grouped by the Tab Titles, with each Object having its Object Title above it.


This makes it easier to navigate on a mobile device


Please note : The global switch nuMobileView in either nuconfig.php or Setup-> Settings has to be set to true.

Tabs (Subform)

All Form types, apart from Browse Forms, require at least one Tab.

Tabs are arranged horizontally above the editable area of an Edit Form.

Tabs allow users to navigate (what seems like) different layers on the same Form.

Title

Tab Title

Order

Displayed order of the Tabs. - Every time the Form is saved these records this will be reordered and renumbered in multiples of 10.

Help

JavaScript that can run to help the user eg. window.open('www.nubuilder.com') or nuMessage(['You must fill in','all fields.']);

SQL

If you want any help building SQL, the SQL Button will direct you to nuBuilder's SQL Builder.


This SQL is used to display records on a Browse Form from either...

An normal SQL Statement eg...

  SELECT * FROM customer

Or an SQL statement that can reference a complicated temporary table created with PHP using a Hash Cookie...

  SELECT * FROM #TABLE_ID#


OR

Used by Subform Objects to order records inside the Subform.

  • Subform Foreign key by default appears in Fast Form (Subform type) when the subform table is absent and needs to be created. This can be altered by removing the marked part of the nuSetFK() function (in case it does not yet exist) attached to the field zzzzsys_form.sfo_javascript in its custom code.

Columns (Subform)

Title

The title of this column, which will appear at the head of the column.

Display

The column of the database that is to be displayed in this column.

SQL formatting functions can be applied to the column as shown in Example 2.

Example 1. cus_name

Example 2. DATE_FORMAT(inv_date,'%m-%d-%Y')

Align

How the text within the column are aligned. The choices are: Left, Right or Center

Format

Used for formatting dates and numbers - The Formatted part of results are not searchable. (Don't search for a $ if it's not in the actual record.)

Width

The width of the Column in pixels.

Order

Order of column. - Every time the Form is saved these records this will be reordered and renumbered in multiples of 10.

Row Height

Height in pixels of each of the Rows in the Browse Form. If left blank this will default to 18px.

Rows Per Page

The maximum number of rows that are displayed on a Browse Page. The remaining rows are displayed on a separate page.
(If left blank this will default to 25 rows)

Redirect To

Redirects the choice made this a Browse Form to another Edit Form.

PHP Code

PHP code can be added at the following places on a Form.

  • BB - Before Browse
  • BE - Before Edit - not available in Subform Forms.
  • BS - Before Save - not available in Subform or Launch Forms.
  • AS - After Save - not available in Subform or Launch Forms.
  • BD - Before Delete - not available in Subform or Launch Forms.
  • AD - After Delete - not available in Subform or Launch Forms.


These sections are explained in the flowchart below.

JavaScript

A Textarea containing JavaScript code - not available in Subform Forms.

To edit this, double click on the Textarea and you will open Ace Editor in a full screen.

This JavaScript can be used on all Forms except for Subforms.


JS in the flowchart below. Click to view larger