Skip to content

Adding a button to a form

Answer

You can add a button by using "Script".


Overview

To add a button after any column or to the command button area, use "Script".

Method of Operation

  1. Open the target table.
  2. Click "Manage" in the navigation menu.
  3. Click "Manage Table".
  4. Click the "Editor" tab.
  5. Enable "Category A" in "Editor Settings".
  6. Click the "Script" tab.
  7. Click the "Create New" button.
  8. Enter any title in "Title" and enter the script below in "Script".
  9. Set "Output to" by referring to the following.
  10. Click the "Change" button.
  11. Click the "Update" button in the command button area.
  12. Open any record or create a new record.

Code Samples

Output to: New or Edit (or both)
1
2
3
4
5
$p.events.on_editor_load = function () {
    const field = $('#' + $p.getField('ClassA')[0].id);
    const btn = '<button type="button" style="float: left;">Button</button>';
    field.after(btn);
};

The button is added with the standard design of the HTML button tag.

Output to: New or Edit (or both)
1
2
3
4
5
$p.events.on_editor_load = function () {
  const btn = $('<button id="NewButton">Button</button>')
    .button({ icon: 'ui-icon-gear' }); // (1)!
  $('#MainCommands').append(btn);
};
  1. Set the button icon in the 'ui-icon-○○' format. For the strings that can be specified, see the following page.
    Icons | jQuery UI API Documentation

The button is added with a design that conforms to Pleasanter.

When you want to change Output to

To set "Output to" to "Grid", change the event firing script to $p.events.on_grid_load. To set "Calendar" or "Crosstab", change the event firing script to that of the screen you set in the same way.