CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Validate time fields [RESOLVED]

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 02/20/2009, 3:48 AM

In the On Validate event of an editable grid I have the following code:

if (strtotime($Container->end_time->GetValue()) <= strtotime($Container->start_time->GetValue()))
{
$Container->Errors->addError("The finish time is the same or smaller than the start time!");
}


The error is always shown.The format of both time fields is h:nn AM/PM

Any ideas?
View profile  Send private message
laneoc

Posts: 154
Posted: 02/22/2009, 12:20 PM

I use a client side "validation rule" setting on the component.

Where "btime" is the component for the beginning time and etime is the component for the end time:

$this->btime->GetValue()<=$this->etime->GetValue()

Lane
_________________
Lane
View profile  Send private message
saseow

Posts: 744
Posted: 02/22/2009, 2:11 PM

Thanks for the reply. I would have thought that it was dead easy but no!

I have :
$work_detail->start_time->GetValue()<=$work_detail->end_time->GetValue()

in the Validation Rule of the end_time Textbox and keep getting the Call to a member function GetValue() on a non-object in error. The form name (work_detail) and the start and end time fields are all named correctly.

I just do not know what the hassle is.
View profile  Send private message
saseow

Posts: 744
Posted: 02/22/2009, 2:19 PM

OK, I still do not know what the problem was but have redone it and it works:

if ($work_detail->start_time->GetValue()>=$work_detail->end_time->GetValue())
{
$work_detail->Errors->addError("The finish time is the same or smaller than the start time!");
}
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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