function validateFun($col,$val,$row)
{
$query = "select groupCode from bloodgroup where groupName = '$val'";
// i want to use and operator to valid "select groupCode from bloodgroup where groupName = '$val' AND rhType = '$val' AND groupName = '$val' like this
$result = mysql_query($query);
if (mysql_num_rows($result) == 0)
{
return true;
}
else
{
$this->Editor->retArr[] = array('where' => 'javascript', 'value' => 'alert("Sorry this value already exists in the Database or either donot chage input value.");');
return false;
}
}
function initiateEditor()
{
$tableColumns['groupCode'] = array('display_text' => 'Code', 'perms' => 'TVQSXO');
// $tableColumns['countryName'] = array('display_text' => 'Country Name', 'perms' => 'EVCTAXQSHO','req' => true);
$tableColumns['bloodGroup'] = array('display_text' => 'Group Name', 'perms' => 'EVCTAXQSHO', 'val_fun' => array(&$this,'validateFun'), 'req' => true);
$tableColumns['rhType'] = array('display_text' => 'Group Type', 'perms' => 'EVCTAXQSHO', 'val_fun' => array(&$this,'validateFun'), 'req' => true);
$tableColumns['groupName'] = array('display_text' => 'Group Name', 'perms' => 'EVCTAXQSHO', 'val_fun' => array(&$this,'validateFun'), 'req' => true,'input_info' => 'size="20"');
$tableName = 'bloodgroup';
$primaryCol = 'groupCode';
$errorFun = array(&$this,'logError');
$permissions = 'EAVIDQCSXHO';
$this->Editor = new AjaxTableEditor($tableName,$primaryCol,$errorFun,$permissions,$tableColumns);
$this->Editor->setConfig('tableInfo','cellpadding="1" width="450" class="mateTable"');
$this->Editor->setConfig('orderByColumn','bloodGroup');
$this->Editor->setConfig('addRowTitle','Add Blood Group');
$this->Editor->setConfig('editRowTitle','Edit Group');
$this->Editor->setConfig('iconTitle','Edit Group');
$this->Editor->setConfig('ascOrDesc','desc');
$this->Editor->setConfig('paginationLinks',false);
$this->Editor->setConfig('tableTitle','Blood Group Master');
//$this->Editor->setConfig('tableName','Country Master');
}
