How to validate (required field) new/edit window form submission.

How to validate (required field) new/edit window form submission.

bukamanushbukamanush Posts: 10Questions: 0Answers: 0
edited September 2013 in General
Hi,

How do I validate DataTable form submission. I want the new/tab windows fields to be required field. I find some links already but not too sure how to use it with CodeIgniter.

public function customise()
{
$this->data['page'] = __FUNCTION__;
$this->data['columns'][] = array('label' => 'ID:', 'name' => 'id', 'mData' => 'id', 'type' => 'hidden');
$this->data['columns'][] = array('label' => 'Name:', 'name' => 'name', 'mData' => 'name'); //this field need to be required
$this->data['columns'][] = array('label' => 'Description:', 'name' => 'description', 'type' => 'textarea', 'mData' => 'description', 'bVisible' => 0); //this field need to be required
$this->data['fields'] = $this->_fields();
$this->data['aoColumns'] = $this->_aoColumns();
$this->data['showSubNav'] = TRUE;

$this->load->view('test.php', $this->data);
}

Thanks,

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi,

    If you have a look at this page http://editor.datatables.net/server/ - specifically the "Add new record with a field error" example, you'll be able to see what JSON the server should return to cause the Editor client-side libraries to show an error for a field.

    Regards,
    Allan
This discussion has been closed.