Need Column Validation

Discuss mysql ajax table editor.

Need Column Validation

Postby anamarphy on Sat Jul 31, 2010 6:23 am

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');
}
as.JPG
as.JPG (17.24 KiB) Viewed 170 times
anamarphy
 
Posts: 4
Joined: Sat Jul 31, 2010 6:12 am

Re: Need Column Validation

Postby admin on Mon Aug 09, 2010 2:35 pm

The $row variable is an array with all the values from the submitted form.
admin
Site Admin
 
Posts: 651
Joined: Fri Jul 11, 2008 1:34 am


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron