CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Date Validation

Print topic Send  topic

Author Message
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?
View profile  Send private message
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.
View profile  Send private message
RonB

Posts: 228
Posted: 03/15/2005, 12:28 AM

It expects a format look at CCFormatDate and CCParseDate in CCS help

Ron
View profile  Send private message
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
View profile  Send private message
PeterJ


Posts: 90
Posted: 04/01/2005, 10:58 PM

Nicole

Thank you.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.