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

 error post question

Print topic Send  topic

Author Message
phpGeek

Posts: 13
Posted: 03/26/2016, 12:48 PM

ok I have been through this code 80 million ways with no results..

ok notice how when a field is required or any given error here is what I am trying to do

instead of posting all errors at once can I post them 1 field at a time example

default code

//Validate Method @2-0E6C0929
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->username->Validate() && $Validation);
$Validation = ($this->email->Validate() && $Validation);
$Validation = ($this->pwd->Validate() && $Validation);
$Validation = ($this->birthdate->Validate() && $Validation);
$Validation = ($this->country->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->username->Errors->Count() == 0);
$Validation = $Validation && ($this->email->Errors->Count() == 0);
$Validation = $Validation && ($this->pwd->Errors->Count() == 0);
$Validation = $Validation && ($this->birthdate->Errors->Count() == 0);
$Validation = $Validation && ($this->country->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method

//CheckErrors Method @2-7068A8F2
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->username->Errors->Count());
$errors = ($errors || $this->email->Errors->Count());
$errors = ($errors || $this->pwd->Errors->Count());
$errors = ($errors || $this->birthdate->Errors->Count());
$errors = ($errors || $this->country->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->DataSource->Errors->Count());
return $errors;
}
//End CheckErrors Method


View profile  Send private message
eratech


Posts: 513
Posted: 03/26/2016, 5:06 PM

@phpGeek - the built in validation will do them all at once and put the results in the ErrorBlock at the top of the form. The code you show is not stopping after each error, just setting up the flags and error messages so it will show them at the end.

You can add your own labels and set errors for specific fields to put the errors in them - look in the Textbox Properties for 'Error Control' - that might give you more control over the errors appearing, but it will still all be at once.

Unless you really need to show each error separately, I would just accept the way CCS does it and move on, otherwise, I would suggest a jquery form validation which will show up as you enter stuff (eg: http://formvalidation.io/ )

Cheers

Eric

_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
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.