Saturday, December 29, 2012
Configuring “Save and Next” Button

A commonly integrated feature in many business applications is a button to save and move to the next record in form view. This allows users to rapidly change many records.

Let’s implement a “Save and Next” action on the Orders form.

Start the Project Designer. In the Project Explorer, switch to the Controllers tab. Right-click on Orders / Actions / ag2 (Form) node, and press New Action.

Creating a new action on the form of Orders controller.

Assign the following values:

Property Value
Command Name Update
Command Argument Next
Header Text Next
When Last Command Name Edit

Press OK to save the action. Drop a100 – Update, Next when Edit | Next action node on the left side of a1 – Edit to place it first in the form.

Dropping action 'a100' on the left side of 'a1'.     Action 'a100' placed first on the form.

Right-click on Orders / Business Rules, and press New Business Rule.

Creating a new business rule for Orders controller.

Assign these values:

Property Value
Type JavaScript
Command Name Update
Command Argument Next
Phase After
Script
if (this.validateInput()) {
    this.preventDefault();
    this.dataView()._advance(1);
}

Press OK to save. On the toolbar, press Browse.

Navigate to the Orders page, and start editing a record.

Editing a record, and pressing 'Next' to save and edit the next record.

Press the Next button – the record will save and the next record will be displayed.

The next record is displayed.

Return to the grid and notice that the changes have been applied.

The changes have been applied to the order records.