1. General information
1.1. Description of the control
Button is a button that serves to call javascript functions in a web browser, server-side scripts, printing database records to printing templates, redirecting the user to a specific edit form or to a specific view page.
1.2. Create a new control
- A detailed description of creating new controls in the edit form is provided in the separate guide Creating edit form controls.
1.3. Edit or delete a control
- For each existing control, a pencil icon appears on the left side of the edit form to change or delete the control's settings.
- Individual controls can be moved vertically in the edit form using the Drag&Drop method. Moving consists of grabbing the control, preferably after its name located in the left column of the edit form, and then dragging it to the desired place in the edit form.
- Controls can be moved only with the “Drag&Drop” check box located above the toolbar with controls selected. For security reasons, this check box is cleared after each login to the application, so that a control is not moved by accident.
2. List of tabs in the control settings dialog
- General – Setting general properties
- Event – Event settings
- Help – Help text settings
- Rights – Rights settings
- Administration – Setting other properties
2.1. “General” tab
2.1.1. Name
- The name of the control displayed in the edit form inside the button.
- Enclosing the control name in two pipe characters sets the button style to type B – for example “|Delete|”.
- A CSS style for the button text can follow after the closing pipe – for example “|Delete|font-weight:bold”.
2.1.2. Dictionary
- The dictionary lists the names of other controls, forms, view pages, categories, applications, and application groups used across the entire application.
- The dictionary search is used to design the correct control name and to maintain the consistency of the nomenclature throughout the application so that controls with the same meaning located in different places in the application are named in the same way.
2.1.3. Width
- The width of the control, expressed in pixels, in the range from 10 to 10,000 px.
- Without a height filled in, this is the minimum width – a longer name widens the button. With a height filled in, the width is fixed and the name wraps to multiple lines inside the button.
- If this input field is not filled in, the width of the button will be determined automatically by the web browser.
2.1.4. Height
- The height of the control, expressed in pixels, in the range from 10 to 10,000 px.
- A filled-in height also makes the width of the button fixed and allows the button name to wrap to multiple lines.
- If this input field is not filled in, the height of the button will be determined automatically by the web browser.
2.1.5. Type
- The type determines the appearance and meaning of the button.
- Type A – a more prominent button used for events with a larger meaning
- Type B – a less prominent button used for less important events
2.1.6. Options
- Hidden button
- The hidden button setting determines whether the button should be part of the edit form, but should not be visible in user mode.
- The hidden button can be found in the source code of the website, and it is also possible to programmatically click on it using javascript (for example, using the javascript function “bt_Click”).
- The hidden button cannot be used as part of security measures, the rights to the control are used for this.
- Snap to previous control
- Checking this box determines whether the button in the edit form should be displayed to the right of the previous one, or it will be displayed in the usual way below the previous control.
- If the previous control is also a button, the buttons are automatically snapped behind each other. This does not apply if either of the two buttons is hidden or if the previous button has a help text filled in.
2.2. “Event” tab
2.2.1. Client
- The “Client” input field specifies a list of javascript commands that are executed when the button is pressed. The drop-down list offers the following frequently used javascript functions:
- Are you sure you want to ... ? – return jsConfirm(this, 'Are you sure you want to ... ?');
- AJAX... – return bt_Eval(this, 'ngef.aspx?test', 'evalFunction');
- Buttons configured as “Script”, “Print to template”, “Open a view page”, or “Open an edit form” first execute the javascript code defined in the “Client” field (if any). For the “Open an edit form” and “Print to template” types, and for the “Open a view page” and “Script” types with step “1. Save the record” or “3. Save the record” checked, the JavaScript of the “Save” button set in the “ActionButtons” control is evaluated after it as well, but only if the code from the “Client” field does not return a value with the “return” command earlier. If the JavaScript of the “Save” button returns a false value, the button is not performed. They then trigger a postback, i.e. a form submission using the POST method, sending all form data including information about the button that initiated the postback.
- The steps set in the “Options” part are then performed on the server side. After they are completed, a button of the “Script” type returns the user to the edit form, unless the script schedules other navigation. Buttons of the other types redirect the user to their target or offer the printed document; navigation scheduled in their script (SCHEDULEFORM, SCHEDULEVIEWPAGE, SCHEDULEURL and others) is not performed, with the exceptions described for the “Open an edit form” and “Print to template” types. During processing, the form content is hidden and the message “Please wait...” is displayed at the top.
- A button click can be triggered programmatically using the javascript function “bt_Click”. A detailed description of javascript functions is provided in the separate guide JavaScript functions.
2.2.2. Server
- The server specifies the type of command to execute when the server-side button is pressed.
2.2.3. Options
- 1. Save the record
- Checking this box determines whether the currently open record in the edit form should be saved after pressing the button in the first step on the server side.
- If the record is not saved successfully, it means to end the execution of the event of this button, return to the edit form and display the error message to the user.
- For the “Print to template” type (forced step “1. Save the record”) and for the “Open an edit form” type without running the script (forced step “3. Save the record”), the forced saving of the record is silently skipped if the edit form shows none of the “Save”, “Save and new” and “Save and continue editing” buttons or if the form is read-only; the button then continues without saving the record.
- 2. Run script
- Checking this box determines whether the server script defined in the graphical script designer should be run after pressing the button in the second step on the server side. A detailed description of the script designer is provided in the separate guide Script designer.
- 3. Save the record
- Checking this box determines whether the currently open record in the edit form should be saved after pressing the button in the third step on the server side.
- Some steps are forced for the given command type – they are checked in the dialog and cannot be changed:
- Open an edit form – “3. Save the record”
- Print to template – “1. Save the record”
- Script – “2. Run script”
(None)
- The button is intended for calling javascript functions in a web browser only.
- A detailed description of javascript functions is provided in the separate guide JavaScript functions.
Open an edit form
- The button redirects the user to a specific edit form in order to create a new record in the database.
- In the target edit form, the value of the foreign key “pid” and “pform” will be set to the currently open record in the form with the button. The script of the button can change the parent record with the “SCHEDULEDEFAULTVALUE” function with the identifier “pid” or “pform”.
Open a view page
- The button redirects the user to a specific view page.
Print to template
- The button starts printing to the selected print template stored in the “NETGenium\Templates” directory.
- All formatting and settings of the resulting file, including adjustments to cell formats, formulas (e.g. autosum) and other calculations, must be performed exclusively in the export template.
- A detailed description of using printing templates is provided in the separate guide Print templates.
- A detailed description of programming printing templates in “pdf” format is provided in the separate guide Programming of print templates in PDF format.
2.2.4. Template
- Select a print template to use for printing from the edit form.
- The drop-down list offers a list of print templates stored in the “NETGenium\Templates” directory.
2.2.5. Sheet
- For printing to XLSX, XLSM, XLS or ODS template only
- Select the sheet to which the printing will be performed from the edit form.
2.2.6. Nested records
- For printing to XLSX, XLSM, XLS or ODS template only
- Insert new rows – NET Genium recognizes the occurrence of identifiers of nested records, and ensures automatic insertion of the values of individual nested records below each other in new rows
- Overwrite rows – NET Genium recognizes the occurrence of nested record identifiers, and ensures automatic insertion of the values of individual nested records below each other into existing rows
2.2.7. Options
- Alternate row background
- For printing to XLSX, XLSM, XLS or ODS template only
- Checking this box determines whether the individual lines of the printed records should be highlighted alternately in gray and white.
- By values in first column
- For printing to XLSX, XLSM, XLS or ODS template only and “Swap Line Colors”
- Checking this box determines whether the color tint should be identical for rows that have the same value in the first column.
- 1 nested record = 1 sheet (XLS) / 1 document (DOC)
- For printing to XLS, XLSX, XLSM, ODS, DOC, DOCX, DOCM or ODT template only
- Checking this box determines how nested records are printed so that each nested record is on a separate sheet (Microsoft Excel) or in a separate document (Microsoft Word); Microsoft Word documents are downloaded as a ZIP archive.
- The nested records are the records of the nearest view table or calendar placed in the edit form above the button.
- Lock the document
- For printing to XLS, XLSX, XLSM, ODS, DOC, DOCX, DOCM or ODT template only, without the “Save as PDF” box checked – checking it hides this option, because a lock makes no sense for a PDF document
- Checking this box determines whether the printed document is protected against writing. The sheets of an Excel file are locked with a password that can be changed using the external function “NETGenium.ExcelPassword”; Word documents are locked without a password and only changes with tracked revisions can be made in them. A detailed description of external functions is provided in the separate guide External functions.
- Save as PDF
- For printing to HTM, HTML, XLS, XLSX, XLSM, ODS, DOC, DOCX, DOCM or ODT template only
- Checking this box determines whether the printed document is saved in PDF format.
- For printing to an HTM or HTML template, checking it displays the “Margins” option – the top, right, bottom and left margin of the PDF document in millimetres.
- Print / Open a new email form / Open an edit form
- The three options determine what happens to the printed document; only one of them can be selected at a time.
- Print – the printed document is offered for download from the currently open edit form. The result of printing to an HTM or HTML template that is not saved in PDF format opens in a new web browser window.
- Open a new email form – the user is redirected to a form for entering a new e-mail message, in which the printed document is automatically attached as an e-mail attachment.
- Open an edit form – the user is redirected to a new record of the selected edit form, in which the printed document is automatically attached as an attachment to the first “File” control.
- If the script of the button schedules opening an edit form with the “SCHEDULEFORM” function and “Print” or “Open an edit form” without a selected form is chosen, the form scheduled by the script opens instead and the document is attached to it.
Script
- The button is used to call javascript functions in a web browser, and then to run a server-side server script.
- A detailed description of javascript functions is provided in the separate guide JavaScript functions.
- A detailed description of the script designer is provided in the separate guide Script designer.
2.3. “Help” tab
2.3.1. Help
- Help text is displayed to the right of the control in the edit form.
- The help texts of all controls start at the same vertical line across the entire edit form.
- Text – the help text is defined by a manually entered text string in a multi-line text field below the radio button
- From query – the help text is defined by the result of a database query that is evaluated when the edit form is opened
- A detailed description of the help text is provided in the separate guide Layout settings.
2.4. “Rights” tab
2.4.1. Rights
- Rights define a list of user groups and users who have permission to view the control on the edit form.
2.4.2. Replace rights to other controls
- The “Replace rights to other controls” function is used to unify the rights within the entire edit form for controls that are related in terms of rights.
- Thanks to the “Show...” link, it is possible to display a list of all controls in the edit form, including setting the rights of these controls. A check box is displayed for each control to select it. When the control is saved, the same rights are then set for the selected controls.
- An alternative for unifying rights within the entire edit form is to display the report available from the “Subordinate object rights” tab in the edit form settings.
2.5. “Administration” tab
- The “Administration” tab is displayed for existing controls only.
2.5.1. Identifier
- The identifier determines the ID of the button in the edit form, which can be used to access the button using javascript.
2.5.2. Statistics
- Statistics display aggregated information about control usage across the entire application.
- Using the “Statistics” button, a detailed report of all places where the control is used or referenced is displayed, including the possibility to open the settings of such a place or control.
- Before each deletion of a control from the edit form, it is recommended to go through the statistics of the control thoroughly, and to eliminate possible misunderstandings.
- Before each deletion of the control from the edit form, the evaluation of the statistics starts automatically. If the control is used or referenced somewhere in the application, the deletion of the control must be reaffirmed.
2.5.3. Logging
- Using the “Logging” button displays a detailed report containing records of the execution of the script defined on the button. The report includes information on:
- the date and time when the script was executed,
- the user who executed the script,
- the script processing time,
- the start date and time of the processing, and
- the end date and time of the processing.
- For logging to function correctly, logging must be enabled in the NET Genium settings on the “Other” tab, either as “To database” or “To database and disk”. A detailed description is provided in the separate guide NET Genium settings.
- The minimum display time for page view processing is set to 0 milliseconds by default, so all view page display records are displayed, including those that took 0 milliseconds to process. This minimum time can be increased or decreased by changing the “mintime” parameter in the report URL.
- The number of records is limited to 100 by default. This number can be manually increased or decreased by changing the “maxrows” parameter in the report URL.
2.6. “Save”, “Save and continue editing”, “Copy”, “Delete”, and “Close” buttons
- “Save” button – Saves changes to the control settings.
- “Save and continue editing” button – Saves changes to the control settings and keeps the settings dialog open for further modifications. Available only when creating a new, unsaved control.
- “Copy” button – Creates a new copy of the current control with identical settings, but with a newly generated unique identifier.
- “Delete” button – Permanently deletes the control.
- “Close” button – Closes the control settings dialog without saving changes.
3. Examples
3.1. Javascript functions
- bt_Click();
- bt_Click(BT123);
- bt_Click('Save');
- return bt_Eval(this, 'ngef.aspx?test', 'evalFunction');
- var bt = bt_FindByText('Today', 2);
- var bt = el(BT123);