Skip to content
This repository has been archived by the owner on Mar 17, 2018. It is now read-only.

Commit

Permalink
Added field and Matrix cell validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Kelly committed Nov 23, 2011
1 parent 5ad4f00 commit d7edea6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions ee2/third_party/pt_field_pack/pt_fieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,44 @@ private function _structure_options(&$options, $total_levels, $level = 1, $inden

// --------------------------------------------------------------------

/**
* Validate
*/
function validate($data)
{
// is this a required field?
if ($this->settings['field_required'] == 'y')
{
// make sure there are selections
if (! $data)
{
return lang('required');
}
}

return TRUE;
}

/**
* Validate Cell
*/
function validate_cell($data)
{
// is this a required cell?
if ($this->settings['col_required'] == 'y')
{
// make sure there are selections
if (! $data)
{
return lang('col_required');
}
}

return TRUE;
}

// --------------------------------------------------------------------

/**
* Prep Iterators
*/
Expand Down

0 comments on commit d7edea6

Please sign in to comment.