I've just committed a new version of the form broker that handles also default values (just adding 'default <value>' to the list)

method 'validate' now accept a third optional parameter as name of an array where the filtered response is copied into. If this argument is specified then the original 'response' array is (should be) untouched

$fbobj validate ?-forcequote? response ?filtered_response?

 -- Massimo

On 10/17/2016 07:51 PM, Karl Lehenbauer wrote:
I haven’t dug into it in depth yet, but this is looking pretty good.
I think a nice addition would be to allow specification of a default
value.  If a var is defined in your FormBroker DDL-type
specification, a default value isn’t defined, and the value is not
present in the response, the broker would raise an error.  Otherwise
if the default value is provided but the value isn’t in the response,
the default would be provided.

Another thing… at work we have been leaning toward copying values as
they are checked and possibly transformed from the response array
into a new array.  That way there’s no risk that a value in the
response array gets used downstream without having been explicitly
called out.  An alternative approach would be to remove any value
from the response array that isn’t in the broker specification (and
possibly treat the presence of something unexpected as a fatal
error).  One way or another I think it is important that a response
value not be able to be used downstream without being explicitly
called out in the broker specification.

To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to