Small Change?

1 view
Skip to first unread message

Don Q

unread,
Jul 28, 2011, 7:09:11 AM7/28/11
to ValidateThis-dev
What do you guys think of this?
http://pastie.org/private/a1w8yddqmjusojxgoakqew

You can see the changes, Result.cfc now has an extra method & a
property, then in BOValidator.cfc Validate() method, I call it.

I started realizing I was serializing and returning the
validationResult through ajax calls by default / accident, then
realized I could attach the actual properties of the result and use it.

Bob Silverberg

unread,
Jul 28, 2011, 9:16:28 AM7/28/11
to validate...@googlegroups.com
Thanks for the suggestion, Don.  I'm not exactly sure why you would need this. The instance struct that you're putting into the memento property isn't really meant to be used directly. You should use the API of the Result object to get at the info you need, as the structure of the instance struct could change at any time.

Can you provide one or more examples of how you would use this?

Also, if this is really something you want, but it's not desired for the overall framework, you can create your own version of the Result object and substitute it for the built-in Result object: http://www.validatethis.org/docs/wiki/ValidateThisConfig_Struct.cfm#Component_Paths

As you can see from that page, you can do the same for the BOValidator object, so you could implement these changes in your own environment without having to alter any of VT's files.

Cheers,
Bob


--
You received this message because you are subscribed to the Google Groups "ValidateThis-dev" group.
To post to this group, send email to validate...@googlegroups.com.
To unsubscribe from this group, send email to validatethis-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/validatethis-dev?hl=en.




--
Bob Silverberg
www.silverwareconsulting.com

Don Quist

unread,
Jul 28, 2011, 3:33:50 PM7/28/11
to validate...@googlegroups.com
Yep, kind of realized that a little later on, I'll give you an example of how I'm using it (even though the JS is a little verbose atm)
http://pastie.org/private/24ygzmp6zh6v2uzkkqhsng

You can see JS at the top, controller at the bottom, an interceptor takes care of returning the whole serialized rc to the client, which of course includes VT's ValidationResult
- Don Quist
www.SigmaProjects.org

Bob Silverberg

unread,
Jul 28, 2011, 9:03:25 PM7/28/11
to validate...@googlegroups.com
I can kind of see what you're doing, but I'm still not sure if it's a good approach.  I haven't had a need to do anything similar. Can someone else chime in on this? John? Adam? Anyone?

Thanks,
Bob

Matt Quackenbush

unread,
Jul 28, 2011, 9:59:36 PM7/28/11
to validate...@googlegroups.com
I have to agree with Flatware, here, but perhaps I have a bit more strong feelings about it.  The instance data of any object should never be shipped outside of that object en masse.  And even if I had an extremely good reason to do so in a particular project, it would be wwwwwwwwwwaaaaaaaaaaaaayyyyyyyyyyyyyyyyyy out there on the outer edge of edge case.  So out there, in fact, that I cannot imagine actually doing it.  Furthermore, if I were to do it, I would do it with a custom object as mentioned earlier.  And lastly, if I were to do it <shudder>, it would not be passed by reference as in the example.

Summed up, I believe this is *not* something that the framework (any framework) should add to its core, as it, at the very least, gives the appearance of promoting what is widely considered an absolute no-no.

/.02

John Whish

unread,
Jul 29, 2011, 3:44:40 AM7/29/11
to validate...@googlegroups.com
Hi Don,

I can see what you're trying to achieve, but using returning a struct
of the variables scope is a bad idea as it is not stable (subject to
change and you'd be also including "private" instance data that the
outside world does not need to know about). Transfer had a getMemento
method and lots of people used it only for Mark to change the private
instance data structure and break a lot of apps. Not Mark's fault as
he never thought people would use it (and I think did even warn them
not to).

Get you proxy method to do something like (not tested!):

result = super.process(argumentCollection=arguments);
return result.validationresult.hasErrors();

- John

Reply all
Reply to author
Forward
0 new messages