Re: [coldbox:18026] New to Coldbox - Validation Question

52 views
Skip to first unread message

Andrew Scott

unread,
Apr 12, 2013, 11:59:47 AM4/12/13
to col...@googlegroups.com
One thing people don't consider, is that validation should be done on all tiers. JS to do the forms and validate at the client, request calls and then database calls would be handled on the server. ColdBox when using ORM uses the last two tiers as part of that validation process.

The validation in ColdBox is for ORM Entities and I think other Bean like objects, not 100% sure on that last part but I am almost certain it is tied into the ORM side of things.



Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



On Sat, Apr 13, 2013 at 1:53 AM, Gavin Pickin <gpi...@gmail.com> wrote:
Hi Guys.

Just wondering what the best practice is for Validation when you do true MVC for Coldbox.
I see Coldbox has its own validation and form engine, its looks very cool too.

I have heard a lot of people use Validate this, on the CF side, but do you put JS validation into the view still, and if so, do you follow a framework for this, or just simple jquery validation?

Or just leave it up to server side only

Thanks for the info.


--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Luis Majano

unread,
Apr 12, 2013, 12:01:05 PM4/12/13
to col...@googlegroups.com
ColdBox validation is strictly server side but you can consume the rules in the front end and apply something in the front too. 

I tend to do server side and HTML 5 validation in front

Luis Majano
CEO
Ortus Solutions, Corp
Toll Free/Fax: 1-888-557-8057
Direct: 909-248-3408
Twitter: @lmajano, @ortussolutions

br...@bradwood.com

unread,
Apr 12, 2013, 12:04:26 PM4/12/13
to col...@googlegroups.com
You'll find lots of answers to that questions, and honestly they're all right as long as they work well for you.  I'll share what I do typically here are work.  We usually do front-end validation with the jQuery validate plugin.  If we have a view file called /views/home/products.cfm, then we'll create a matching JS file called /js/home/products.js that we include with the HTMLHelper plugin on the view page.  The js file binds to the form and does what it needs.

Our server side validation started as mostly a series of checks in our handlers after forms were submitted that used the messagebox plugin to render error messages and then redirected back to the form page.  The later stuff we've wrote, we've just made custom validate() methods in our beans and called those after setting the data.

We probably would have used the ColdBox validation had it existed when we first started using ColdBox, but we got stuck in our ways long before it came out :)

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 

Jason Durham

unread,
Apr 12, 2013, 12:59:24 PM4/12/13
to col...@googlegroups.com
As far as I know, ValidateThis is the only CFML validation tool that will generate client and server side validation based off the same configuration.  Hyrule is another option if you plan to write your own client-side validation.

Jason Durham

Luis Majano

unread,
Apr 12, 2013, 1:33:23 PM4/12/13
to col...@googlegroups.com
Validation is for any object and structure or collection. 


Luis Majano
CEO
Ortus Solutions, Corp
Toll Free/Fax: 1-888-557-8057
Direct: 909-248-3408
Twitter: @lmajano, @ortussolutions

Exist~Dissolve

unread,
Apr 12, 2013, 2:02:10 PM4/12/13
to col...@googlegroups.com
A lot of the apps I write at work are nearly 100% JS (using ExtJS 4.2), so any request I make to the server is via AJAX. Because of this, I tend to do most data-specific validation (outside of HTML5-ish validation) with ColdBox alone, and update the client validation "state" based on the response from the server. 

So for example, when a form is submitted, the request is handled by ColdBox, my entities are populated (using ORM), and then validated using CB validation. If validation fails, the response back to the JS app includes the errors, as well as the fields which produced the errors. I then have a global function that sits on top of all AJAX responses that is able to take the returned errors and apply "state" to the fields in the currently active form, such as warning messages, red outlining, tooltips, etc.

While it's not bullet-proof (some client-side-specific validation is necessary for certain scenarios), one reason I like this approach is that I can keep validation centralized, and not have to worry about needing to make updates in multiple places as the application inevitably expands.


On Fri, Apr 12, 2013 at 10:53 AM, Gavin Pickin <gpi...@gmail.com> wrote:
Hi Guys.

Just wondering what the best practice is for Validation when you do true MVC for Coldbox.
I see Coldbox has its own validation and form engine, its looks very cool too.

I have heard a lot of people use Validate this, on the CF side, but do you put JS validation into the view still, and if so, do you follow a framework for this, or just simple jquery validation?

Or just leave it up to server side only

Thanks for the info.


--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
The only thing we learn from history is that we learn nothing from history.

http://singularityconcepts.com

Gavin Pickin

unread,
Apr 12, 2013, 9:19:54 PM4/12/13
to col...@googlegroups.com
Thanks for all the great responses. Really helps to see what everyone is doing.
Reply all
Reply to author
Forward
0 new messages