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

 Get Number of Errors for "Required" Controls

Print topic Send  topic

Author Message
JayEdgar


Posts: 77
Posted: 03/08/2012, 8:40 AM

How can I get a count of the errors if a field marked Required is not filled in? I've done a bunch of searching.

I've tried $Results->Errors->Count(), print(r) the entire error block, etc., I can't find anything.

Of course I could turn off Required and do my own validation, and I really don't want to have to do that.

Thanks in advance,

Jay
View profile  Send private message
DataDoIT
Posted: 03/08/2012, 10:09 AM

The correct object would be $Container->Errors->Count().

However, it depends on -where- you're attempting to capture that.
Validation occurs in this order:

Field property settings (such as Required = Yes)
Field OnValidate event if one exists
Record OnValidate event if one exists

So there's no place that I can think of where you would be able to
capture the Required = Yes validation, unless you go into the .php code
and hack the generated code (don't do that ever).

Your best bet is to put all of your validation into the record form's
OnValidate event if you need to capture error counts and react upon that
count accordingly. We do this often so that we don't have to show a
gozillion error messages in the Error control, such as a long form with
lots of Required fields.
JayEdgar


Posts: 77
Posted: 03/08/2012, 10:49 AM

That's disappointing, and seems like a big hole in the capabilities of CCS.

Thanks for the response, DDI. And I do, indeed, know to never hack the grayed out code. :o)

I submitted a help request. This is something the system should really be able to do.

Thanks again,

Jay
View profile  Send private message
clahti2

Posts: 107
Posted: 03/08/2012, 7:58 PM

yes agreed, there should be an onError event that you can write custom code to and bypass all the other crap.
View profile  Send private message
phpminer

Posts: 28
Posted: 03/08/2012, 10:39 PM

You can also get these error counts for empty fields by iterating through your form field objects
using javascript. I realize this may not be what you want, but it's better to deal with blank fields
within client-side code instead of through server-side code.


View profile  Send private message
JayEdgar


Posts: 77
Posted: 03/09/2012, 2:13 AM

In some cases that may be true, phpminer. However, with the refresh rate being very quick, this would really just increase development time. My budget for this project is rather strict, and I can't afford the time. Thanks for the thoughts.

Quote phpminer:
You can also get these error counts for empty fields by iterating through your form field objects
using javascript. I realize this may not be what you want, but it's better to deal with blank fields
within client-side code instead of through server-side code.
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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