PeterJ
Posts: 90
|
| Posted: 03/12/2005, 11:14 AM |
|
I want to establish a validation rule for a date in the DB. The date is stored as a varchar as 0000-00-00
The rule I have tried to use is $this->value->fieldname > Date()
This throws an error informing me that the date appears to be in the wrong format.
Warning: Wrong parameter count for date() in /home etc...
Can anyone assist with a solution please?
|
 |
 |
PeterJ
Posts: 90
|
| Posted: 03/13/2005, 11:24 AM |
|
Solved by changing the date field to DATE and created a hidden text box with CurrentDate as default then applied:
$this->Hidden2->GetValue() < $this->datestart->GetValue()
Could not immediately see a way of resolving the query against DATE() rather than the hidden test box.
|
 |
 |
RonB
Posts: 228
|
| Posted: 03/15/2005, 12:28 AM |
|
It expects a format look at CCFormatDate and CCParseDate in CCS help
Ron
|
 |
 |
Raji
|
| Posted: 03/31/2005, 12:53 AM |
|
Even I also facing the same prob...I tried to put CCFormatDate and CCParseDate but still giving error:
Notice: Use of undefined constant CCFormatDate - assumed 'CCFormatDate' in .....
so how i overcome this. Thank u
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 03/31/2005, 4:32 AM |
|
Hello,
I successfully use CCS Validate Minimum Value action in form’s onValidate event to validate Date type field (compare it with a current date). The code produced by CCS requires one modification only: instead GetValue() for date field GetText() should be used.
FYI: GetValue() returns date value as array, while GetText() returns is as a string.
In general here is a code that works for me
global $form_name;
if (strlen($form_name->date_resolved->GetText()) && $form_name->date_resolved->GetText() < date("Y-m-d"))
{
$form_name->date_resolved->Errors->addError("date is less than today");
}
Hope it helps.
_________________
Regards,
Nicole |
 |
 |
PeterJ
Posts: 90
|
| Posted: 04/01/2005, 10:58 PM |
|
Nicole
Thank you.
|
 |
 |