ArtiGrid
v2.0

Clear From On Insert

ArtiGrid allows you to generate standalone insert forms using the render('insert') mode.

This mode displays only the form for creating new records, without showing the grid.

You can combine it with formFields() and validation methods to fully control which fields are displayed and required.

With the clearFormOnInsert() method, the form fields are cleared automatically right after a record is successfully inserted, so the user can create a new one without manually erasing the previous values.


<?php
    $grid = new ArtiGrid();
    $grid->table('payments')
        ->template('bootstrap5')
        ->required(false)
        ->formFields([
            'customerNumber',
            'checkNumber',
            'paymentDate',
            'amount'
        ])
        ->validation_required([
            'paymentDate',
            'amount'
        ])
        ->validation_required_group([
            'customerNumber',
            'checkNumber'
        ]);
    $grid->clearFormOnInsert();
    echo $grid->render('insert');
?>