Sign Doug's SOTR Petition!
spacer
Sign Doug's petition to his boss and help send him to Scotch on the Rocks in 2012!
Recent Entries
Obama Got Osama? Not!

My Short Open Letter to President Obama

How We Know Obama Hates America

Picking Up Where Interfaces Fail

Approaches to Building Strings: The Imploding Array

JBase: The Virtual Relational Database Component

Fredrick "French" Fry

JBase Documentation Ready for Peer Review

Utilizing Multiple CFLocks with the Same Name

The Future of CFML

Rennaissance Man

Bank of America, YOU SUCK!

Use Case for Circular Dependency

Adding Mura Components to a Page Without Cascading

Using Ajax in Mura

Porting Coldfusion Code to Mura

Adding and Customizing Mura Editor Styles

Review of Capital One Bank

Liberals are from Venus, The Rest of Us are from Mars

The Birth, Evolution, and Meaning of The Tea Party

spacer
Contact Doug!
Email Doug!
Learn About Doug!
spacer
updated 11/18/2009

spacer
Link to me!

spacer
Follow me!

spacer
Befriend me!
(I promise not to follow you home)
OO Lexicon
Doug Boude's OO Lexicon
Chat with Doug!
NO MORE CAREER
POLITICIANS!
spacer
You may also be interested in...
Web Hosting
best web hosting - top web hosting sites, thetop10bestwebhosting.com

Czech your Page Rank!
Check Page Rank of any web site pages instantly:
This free page rank checking tool is powered by Page Rank Checker service
Surf's Up!
Visit Egosurf.org and massage YOUR web ego!
My Score: 9,001
Doug's Books

Read (and recommend)

  • Men are from Mars, Women are from Venus
  • The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How Collective Wisdom Shapes Business, Economies, Societies and Nations
  • Blink: The Power of Thinking Without Thinking
  • Head First Design Patterns
  • Transact-SQL Programming
  • What's So Amazing About Grace?
  • Just So Stories (Rudyard Kipling collection)

Reading

  • Prayer: Does it Make Any Difference?
  • Data Mining (Practical Machine Learning Tools and Techniques)
<< July, 2011 >>
SMTWTFS
12
3456789
10111213141516
17181920212223
24252627282930
31
Search Blog

Recent Comments
Re: Adding a Railo Site in W2k8/IIS7/Tomcat Environment (by dcolumbus at 7/23 10:33 PM)
Re: Railo 3.1 on Windows Server 2008 and IIS7 - Part 3 of 3 (by dcolumbus at 7/23 9:47 PM)
Re: Railo 3.1 on Windows Server 2008 and IIS7 - Part 3 of 3 (by dcolumbus at 7/23 9:34 PM)
Re: Equivalent of SQL "TOP X" in Oracle (by Paulo Miguel Almeida at 7/13 1:35 PM)
Re: PHP Export to Excel Snippet (by dougboude at 7/05 9:29 AM)
Re: PHP Export to Excel Snippet (by Denise Cowen at 7/04 3:09 PM)
Re: TinyMCE Refusing to Display Icons (by Steve at 6/19 4:24 PM)
Re: Refreshing Cached ColdFusion Webservices Through the Back Door (by Jongr67 at 6/17 12:55 PM)
Re: CF tags within CFSCRIPT Blocks (by kris at 6/06 7:17 AM)
Re: American Airlines, YOU SUCK! (by Edward at 6/02 6:03 AM)
Re: Assurant Health (NYSE:AIZ) Denies Coverage Because Young Man is Autistic (by Thomas Brown at 5/21 7:19 AM)
Re: Just What Is 'Application Logic', Anyway? (by test at 5/17 8:51 AM)
Re: SQL Forward Engineering with Visio 2003 Professional (by Noel at 5/06 4:43 PM)
Re: PHP Export to Excel Snippet (by Ben Lam at 5/06 1:15 PM)
Re: Obama Got Osama? Not! (by dougboude at 5/06 10:54 AM)
Re: Obama Got Osama? Not! (by dougboude at 5/05 9:43 AM)
Re: Obama Got Osama? Not! (by dougboude at 5/05 9:41 AM)
Re: Obama Got Osama? Not! (by Erica at 5/04 6:00 PM)
Re: Obama Got Osama? Not! (by dougboude at 5/03 2:35 PM)
Re: Obama Got Osama? Not! (by jay at 5/03 2:22 PM)
Categories
Ajax (4) RSS
code snippets (45) RSS
ORACLE (1) RSS
Arts & Humanities (1) RSS
bill's browser (3) RSS
CFML (1) RSS
CFUNITED (7) RSS
Coldbox (10) RSS
ColdFusion (77) RSS
coldspring (5) RSS
D2W (4) RSS
Eclipse (3) RSS
family (33) RSS
firefox (1) RSS
FLEX (1) RSS
Frameworks (20) RSS
Fusebox (2) RSS
FusionCharts (2) RSS
goog (176) RSS
hydrogen power (1) RSS
i18n (1) RSS
idea (7) RSS
ie (4) RSS
Java (2) RSS
javascript (14) RSS
JBase (3) RSS
JSON (4) RSS
Model-Glue (30) RSS
movie review (2) RSS
Mura (4) RSS
mysql (2) RSS
observations (31) RSS
OOP (26) RSS
OpenCFSummit (1) RSS
Personal (69) RSS
PHP (6) RSS
placeblogger (31) RSS
politics (6) RSS
Railo (6) RSS
rant (30) RSS
S.E.E. (4) RSS
scripts (2) RSS
SQL (8) RSS
Story (6) RSS
xclaim (1) RSS
Archives
May 2011 (1)
April 2011 (7)
March 2011 (1)
February 2011 (3)
January 2011 (5)
November 2010 (4)
October 2010 (1)
September 2010 (1)
July 2010 (2)
June 2010 (6)
May 2010 (2)
April 2010 (2)
March 2010 (3)
February 2010 (3)
January 2010 (1)
December 2009 (3)
November 2009 (4)
October 2009 (3)
September 2009 (11)
August 2009 (4)
July 2009 (4)
June 2009 (5)
May 2009 (2)
April 2009 (2)
March 2009 (5)
February 2009 (1)
January 2009 (3)
December 2008 (7)
November 2008 (10)
October 2008 (5)
September 2008 (2)
August 2008 (2)
July 2008 (4)
June 2008 (2)
May 2008 (6)
April 2008 (1)
March 2008 (6)
February 2008 (6)
January 2008 (5)
December 2007 (1)
October 2007 (5)
September 2007 (14)
August 2007 (11)
July 2007 (9)
June 2007 (6)
May 2007 (2)
April 2007 (1)
March 2007 (7)
February 2007 (3)
September 2006 (7)
August 2006 (8)
July 2006 (7)
June 2006 (16)
May 2006 (3)
Photo Albums
Funnies (5)
Family (3)
RSS
RSS 1.0 (all)
More RSS feeds...

Powered by
BlogCFM v1.11

12 September 2007
Snippet: Outputting Reactor Validation Structures
Categories:   Frameworks goog ColdFusion code snippets Model-Glue
Reactor's built-in validation produces a validationError structure when it encounters something amiss, and passes it back to your viewstate. That structure is actually a structure of arrays.

I DO use Reactor's validation, and found myself copying and pasting the same snippet for outputting the validation error results a time or two this morning... figured it might come in handy for other folks, too.

code from my view template...
<cfset validation = viewstate.getValue("[name of error structure here]", structnew()) />

<cfif structcount(validation) gt 0>
    <cfoutput>
        <cfloop collection="#validation#" item="v">
            <cfloop from="1" to="#arraylen(validation[v])#" index="i">
                #validation[v][i]#<br>
            </cfloop>
        </cfloop>
    </cfoutput>
</cfif>


A couple of things to remember:

1. The "[name of error structure here]" value is determined by the value you gave it in your event

sample generic Commit showing where the name of the validation error structure is designated...
<message name="ModelGlue.genericCommit">
    <argument name="recordName" value="ClientRecord" />
    <argument name="criteria" value="ClientID" />
    <argument name="object" value="Client" />
    <argument name="validationName" value="PreferenceValidation" />
</message>


2. When calling the viewstate.getValue() method, you can specify a default value to use if the item isn't found. In my snippet, I specified that "if the validation structure isn't there, just give me back an empty structure so my code won't break".

That's it!



Posted by dougboude at 1:23 PM | PRINT THIS POST! |Link | 0 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Comments

No comments found.

Post a Comment
Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Time to take the Turing Test!!!

Sixteen plus Thirteen equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.