--
You received this message because you are subscribed to the Google Groups "ValidateThis" group.
To view this discussion on the web visit https://groups.google.com/d/msg/validatethis/-/PXAoJS3cNDkJ.
To post to this group, send email to valida...@googlegroups.com.
To unsubscribe from this group, send email to validatethis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/validatethis?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "ValidateThis" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/validatethis/-/Sgn_ohmfu38J.
Can I request that you use .length instead of size() as there is a
slight performance improvement.
Also, do people think that a client side field should be ignored by
the client side validation if missing _and_ required?
> --
> You received this message because you are subscribed to the Google Groups
> "ValidateThis" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/validatethis/-/orklz9UnJVkJ.
That's what I think as well. Glad you agree :)
- John
It sounds like that might be the answer to this scenario, and maybe
the others requiring this as well.
From my perspective, if we want to make VT handle client-side
"problems" gracefully by ignoring form fields that it expects but do
not exist (which I think is a reasonable idea), then I think it should
always ignore those, regardless of whether the field is required or
not. This is no longer about enforcing validation rules, but rather
about how to handle exceptions. A missing form field that should
actually be there is a pretty major exception which I would hope would
be caught by some mechanism other than VT. VT's job isn't to make sure
developers don't make mistakes - it's to enforce the rules that a
developer tells it to, to the best of its ability. If it cannot
enforce a rule because a form field doesn't exist then I think it
makes perfect sense for it to ignore that rule altogether.
That's my take on this anyway.
Bob
> --
> You received this message because you are subscribed to the Google Groups
> "ValidateThis" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/validatethis/-/WiL0nayViGAJ.
>
> To post to this group, send email to valida...@googlegroups.com.
> To unsubscribe from this group, send email to
> validatethis...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/validatethis?hl=en.
--
Bob Silverberg
www.silverwareconsulting.com
1. Will adding the feature described in
https://github.com/ValidateThis/ValidateThis/issues/39 actually
address the use cases that have been brought up? Would this mean that
we don't need to have the framework check for the existence of form
fields before accessing them?
2. If we still feel that the framework should check for the existence
of form fields before accessing them, are we happy to put that check
in place using .length()?
2b. Do people agree that if that check is in place it should always
be done, regardless of what the rule is (i.e., it doesn't matter if
the rule is a required rule)?
I will try to take a stab at adding the feature this week to address item #1.
Thanks,
Bob
--
Bob Silverberg
www.silverwareconsulting.com
Perhaps if others do want VT to throw an exception in this case a config flag called ignoreMissingClientFields or something can be added to the VT config. Or a message could be logged to the browser console notifying the programmer of the missing field.
> > > To post to this group, send email to valida...@googlegroups.com (mailto:valida...@googlegroups.com).
> > > To unsubscribe from this group, send email to
> > > validatethis...@googlegroups.com (mailto:validatethis...@googlegroups.com).
> > > For more options, visit this group at
> > > http://groups.google.com/group/validatethis?hl=en.
> >
> >
> >
> >
> >
> > --
> > Bob Silverberg
> > www.silverwareconsulting.com (http://www.silverwareconsulting.com)
>
>
>
>
>
> --
> Bob Silverberg
> www.silverwareconsulting.com (http://www.silverwareconsulting.com)
>
> --
> You received this message because you are subscribed to the Google Groups "ValidateThis" group.
> To post to this group, send email to valida...@googlegroups.com (mailto:valida...@googlegroups.com).
> To unsubscribe from this group, send email to validatethis...@googlegroups.com (mailto:validatethis...@googlegroups.com).
To post to this group, send email to valida...@googlegroups.com.
To unsubscribe from this group, send email to validatethis...@googlegroups.com.
Plus, the exception halts further validation of the form which is totally inconsistent with every other validation that VT does. If a missing field was treated like all other field validations and a message was displayed saying, "The [field name] is required but is missing on the form" and then continued validating the form, it would be more consistent with the rest of the framework.
Since this is new behavior it took me quite a while to figure out why the exception was being thrown. As discussed earlier, 0.99 didn't behave like this. John even said that he may have been "overzealous" in optimizing the Javascript which says to me that the current behavior wasn't on purpose or expected. And if VT was behaving in a particular way for the last several versions and was inadvertently changed, do we want everyone using VT to be forced to change the way they use the framework because of an accidental change?
I completely agree that VT should validate "according to the rules it has been provided". It's just a matter of who to trust more: the programmer or the framework? Do we give the programmer the flexibility to use VT in multiple ways and trust that they have a good reason for leaving a field off a form? Or do we force the programmer to use the framework in only one way and throw an exception in an effort to prevent "sloppy coding habits".
At the very least I think a configuration option needs to be added so the original behavior can be restored.
Dustin
On Tuesday, January 31, 2012 at 7:13 PM, Matt Quackenbush wrote:
> I wholeheartedly agree with you that VT's job is to validate data. Where I disagree is that I believe VT should validate _according to the rules it has been provided_. This means that if it has a rule and a missing field/property/value, VT returns an invalid result. It should never simply ignore rules it has been provided and is tasked to enforce.
>
> The fact that VT already supports "ignoring missing fields" via the use of contexts is, in my opinion, quite sufficient. That said, I suppose I'm not totally opposed to some sort of `ignoreMissingClientFields` flag as you've suggested, provided that it defaults to false (keeping the current behavior as the default). Although I'm not really a big fan of adding in a bunch of configuration options for edge cases, I realize that sometimes it's a necessary evil.
>
> HTH
>
> > > > > To post to this group, send email to valida...@googlegroups.com (mailto:valida...@googlegroups.com) (mailto:valida...@googlegroups.com).
> > > > > To unsubscribe from this group, send email to
> > > > > validatethis...@googlegroups.com (mailto:validatethis%2Bunsu...@googlegroups.com) (mailto:validatethis...@googlegroups.com (mailto:validatethis%2Bunsu...@googlegroups.com)).
> > > > > For more options, visit this group at
> > > > > http://groups.google.com/group/validatethis?hl=en.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Bob Silverberg
> > > > www.silverwareconsulting.com (http://www.silverwareconsulting.com) (http://www.silverwareconsulting.com)
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Bob Silverberg
> > > www.silverwareconsulting.com (http://www.silverwareconsulting.com) (http://www.silverwareconsulting.com)
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "ValidateThis" group.
> > > To post to this group, send email to valida...@googlegroups.com (mailto:valida...@googlegroups.com) (mailto:valida...@googlegroups.com).
> > > To unsubscribe from this group, send email to validatethis...@googlegroups.com (mailto:validatethis%2Bunsu...@googlegroups.com) (mailto:validatethis...@googlegroups.com (mailto:validatethis%2Bunsu...@googlegroups.com)).
> > > For more options, visit this group at http://groups.google.com/group/validatethis?hl=en.
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "ValidateThis" group.
> > To post to this group, send email to valida...@googlegroups.com (mailto:valida...@googlegroups.com).
> > To unsubscribe from this group, send email to validatethis...@googlegroups.com (mailto:validatethis%2Bunsu...@googlegroups.com).
> > For more options, visit this group at http://groups.google.com/group/validatethis?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups "ValidateThis" group.
I think there is just a fundamental difference between what VT can and
should do on the server vs the client. It doesn't really have control
on the client. It just generates JS that then has to be executed on
the client, whereas on the server it is in total control and can add
exception information to the result object. I think, if possible, VT
needs to always generate valid JS that will execute without error, and
it sounds like it was doing that before. So really this is a bug that
needs to be fixed.
John is the go to person for client-side code now, so if he's happy
with the length() solution then I think we need to add that back in.
Bob
> To post to this group, send email to valida...@googlegroups.com.
> To unsubscribe from this group, send email to validatethis...@googlegroups.com.
Dustin
In case anyone is interested, you can now specify an attribute of
"processOn" in your rule metadata. A value of "client" will have the
rule only enforced on the client, a value of "server" will have the
rule enforced only on the server, and any other value will have the
rule enforced on both the client and the server.
Let me know if anyone has any questions about this,
Bob
> To post to this group, send email to valida...@googlegroups.com.
> To unsubscribe from this group, send email to validatethis...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/validatethis?hl=en.
>
--
Bob Silverberg
www.silverwareconsulting.com
On Tuesday, January 31, 2012 at 10:56 PM, Bob Silverberg wrote:
> OK, I have merged Dustin's pull request, and I have also implemented
> the processOn behaviour, both of which are in the develop branch on
> GitHub. They will both be included in the next release.
>
> In case anyone is interested, you can now specify an attribute of
> "processOn" in your rule metadata. A value of "client" will have the
> rule only enforced on the client, a value of "server" will have the
> rule enforced only on the server, and any other value will have the
> rule enforced on both the client and the server.
>
> Let me know if anyone has any questions about this,
> Bob
>
> Bob Silverberg
> www.silverwareconsulting.com (http://www.silverwareconsulting.com)
>
I personally like my JavaScript to only reference fields on my form,
but I'm completely happy that this might just be me and others would
rather it silently ignored it :)
> To post to this group, send email to valida...@googlegroups.com.
> To unsubscribe from this group, send email to validatethis...@googlegroups.com.
>
> I personally like my JavaScript to only reference fields on my form,
> but I'm completely happy that this might just be me and others would
> rather it silently ignored it :)
>
Are you agreeing with the approach Dustin wrote or not? Are you saying
that you would want the JS that VT generates to attempt to use form
fields that may not exist on a form?
Cheers,
Bob
--
Bob Silverberg
www.silverwareconsulting.com
Sorry for the confusion. I'm happy with the changes that Dustin has
made (thanks Dustin!)
- John