Activerecord as form

This form is created from the activerecord $customer = new \customer(); and get the form $form = $customer->get_form(); and finaly render the form $form->panelize($form)->render();

// create activerecord
$customer = new \customer();
// get the form
$form = $customer->get_form();
// make the form send its data by ajax back to this function
$form->is_ajax();
// form is send but seckey is invalid
if($form->is_send() && !$form->is_valid()){
    $this->ShowZebraDialog('Error', 'Your form has an invalid seckey', 'error');
}
// valid form send
if($form->is_send() && $form->is_valid()){
    $this->ShowModal('You send this data:', '<pre>'.print_r($_POST, true).'</pre>');
}
//secure the form
$form->secure_form();
// assign the form to the view
$this->view->form = $form;