Create a Form View in KAS

Build native KAS forms with full-array addField definitions and normal save handling.

Use F for Form View, FA for an ordinary Add form and FU for an ordinary Edit form. Reuse native routing, fields, validation and submission.

Arrays are the newer full, extensible configuration and are preferred for new definitions. Strings remain compatible legacy shorthand/quick syntax. Option keys are specific to each native field type.

This example assumes an existing authorized application table and corresponding fields; adapt every schema name and route to the owning page.

$dbtable = 'EXISTING_TABLE';
$idfield = 'ROW_ID';
$case_title = 'ADD ITEM';
$message = 'Item saved';
$form = 'open';
include('core/form_view.php');
addField([
    'type' => 'text', 'name' => 'NAME', 'id' => 'item_name',
    'label' => 'Name', 'attributes' => 'required maxlength="100"'
]);
addField(['type' => 'button', 'name' => 'save', 'value' => 'item']);
$form = 'close';
include('core/form_view.php');

Keep fields inside the page's native form_div/categoryBlock layout with its normal spacing. For Edit, supply the authorized row identifier and load its existing values. Set nexturl and message for the native save return where needed.

Ordinary forms use automatic KAS_FORM submission through db_actions. Do not add a second AJAX save handler just to persist standard fields. Browser attributes and hidden/disabled controls do not replace server-side authorization or validation. Manual submission is a specialized exception, not the default form pattern.

Customer transactional notification permissions

For native customer registration, include the reusable permission controls inside the ordinary CLIENTS INSERT Form View after its customer fields. Transactional SMS and WhatsApp each default to Unknown. Allowed or Opted Out requires an explicit international destination, consent source and supporting-record reference. These controls do not grant marketing subscriptions.

// Inside the ordinary native CLIENTS INSERT Form View:
include kas_root('includes/BILLING/CLIENT_MESSAGE_PERMISSION_FIELDS.php');
addField(['type'=>'button', 'name'=>'save', 'value'=>'client']);

The normal db_actions extension validates these optional fields and removes them before the ordinary query builder. Client creation and permission/audit writes share a transaction. Existing forms omitting the controls do not acquire consent automatically. Existing customer permissions are managed through Client Summary, with independent exact-number channel states and append-only audit records.

See Customer messaging permissions and audited bulk attestation for the administrative workflow and customer-profile integration boundary.