Welcome Guest, Not a member yet? Register   Sign In
callback help
#1

[eluser]Unknown[/eluser]
I need to check a field in the DB, budget_min against the bid amount. I built this function based on the form validation documents. But, I'm unsure how to get this to verify the db table (projects) and field (budget_min). Also, what about my other required items 'required|is_natural_no_zero|trim|xss_clean' how do I also get those requirements fulfilled?

//Set rules original $this->form_validation->set_rules('bidAmt','lang:Bid_Amount_validation','required|is_natural_no_zero|trim|xss_clean' );

//Set rules modified
$this->form_validation->set_rules('bidAmt','lang:Bid_Amount_validation','callback_BidAmt_Check');

//function called by callback
function BidAmt_check($Amt)
{
if($Amt == projects.budget_min)
{
$this->form_validation->set_message('BidAmt_check', 'You cannot bid less than the project min. Amount');
return FALSE;
}
else
{
return TRUE;
}
}

Errors that I get when testing:
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant projects - assumed 'projects'
Filename: controllers/project.php
Line Number: 813

A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant budget_min - assumed 'budget_min'
Filename: controllers/project.php
Line Number: 813




Theme © iAndrew 2016 - Forum software by © MyBB