CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> Archive -> GotoCode Archive

 is zero not an integer?

Print topic Send  topic

Author Message
phpmonkey
Posted: 09/11/2002, 6:16 PM

i have a field that is an integer - let's call it "count".

on count i have required = yes.

however, the ccs-generated code does not consider 0 to be a valid integer.

any way around that?
Ken
Posted: 09/12/2002, 4:45 AM

0 is not a valid integer. The integer variable type in PHP is used for whole numbers and 0 is not a whole number. Start your counter at 1, and you should be fine.
Alex Alexapolsky
Posted: 09/13/2002, 8:04 AM

Do you get any error message or something ?
phpmonkey
Posted: 09/13/2002, 8:07 AM

well, i get the "The value in field Quantity is required" error message.

the problem is that 0 (zero) is a valid quantity. but ccs/php code does not allow for 0 to be considered and integer.

i am trying to trace my way through the validation code in hopes that i can just rewrite part of it. or i guess i could just write my own custom validation for the field in question.

of course i have the same problem with 0.00 not being considered a valid float.
Nicole
Posted: 09/16/2002, 4:57 AM

Hello,
to overcome the problem, edit Validate() function in Classes.php file. Replace
the line
if($this->Required && ($this->Value == "" && $this->Value !== false) && $this->Errors->Count() == 0)
with
if($this->Required && (strlen($this->Value) == 0 && $this->Value !== false) && $this->Errors->Count() == 0)

   


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.