nette/nette — pull request #1234 by xificurk (2013-09-07 16:57:29+00:00)
Title: netteForms.js: Make it easier to override retrieving of element value and rule arguments expansion

1) Method getEffectiveValue is used for retrieving a value of an element for the purpose of its validation, the error reporting still uses getValue method, so the user is presented with the actual value of the element (in the error message).
The default implementation filters out "empty value".
Here comes the fun part - imagine you have a datepicker input and you want to add RANGE rule to limit the allowed dates... that's pretty easy now:

```javascript
Nette.getEffectiveValue = function(elem) {
if (window.jQuery && jQuery(elem).hasClass('hasDatepicker')) {
var val = jQuery(elem).datepicker('getDate');
return val ? val.getTime() : null;
} else {
...
}
}
```

Effective value is now an integer which can be used for comparisons in RANGE validation.

2) Method expandRuleArgument is used for expanding the rule arguments for the purpose of validation. The default implementation replaces references to other controls with their current effective value.
The motivation here is that you may want to use objects as arguments for your validation rules, e.g. DateTime instance, which can be directly compared on server-side, but on client-side you need to parse it before passing it to validator.