Lizam
|
| Posted: 10/23/2005, 7:15 PM |
|
Hi,
Anyone knows how to do this in CCS? Below code is not working for EDITABLE GRID. The combined fields are company_id and product_id.
On Validate:
$g_cnt = CCDLookUp("count(*)","detail","company_id=".
CCGetParam("company_id"). " AND product_id=".
$grid->product_id->GetValue(),$DB);
if ($g_cnt <> 0) {
$grid->Errors->addError("Record already exist!");
}
Thanks in advance.
|
|
|
 |
Lizam
|
| Posted: 10/25/2005, 7:00 PM |
|
Hi,
Found out the workaround finally. Below is what I did:
1. On the design mode, set the Unique property of company_id to 'Yes'.
2. View the CCS generated php code and look for function ValidateRow($RowNumber) and change the code that check for the existance of value (CCDLookUp) to include the other field (product_id)
if(CCDLookUp("COUNT(*)", "detail", "company_id=" .
$this->ds->ToSQL($this->ds->company_id->GetDBValue(), $this->ds->company_id->DataType) .
" AND product_id=" .
$this->ds->ToSQL($this->ds->product_id->GetDBValue(), $this->ds->product_id->DataType) .
$Where, $DB) > 0)
Best regards.
|
|
|
 |
|