coldbox-modules / cbwire

CBWIRE is a ColdBox module that makes building reactive, modern apps easy using HTML-over-the-wire technologies and CFML.
https://cbwire.ortusbooks.com
Other
28 stars 5 forks source link

On wire components, add getDataProperties() and getComputedProperties() for easier access #87

Closed grantcopley closed 1 year ago

grantcopley commented 1 year ago

When using things like cbValidations for validating forms, if you are creating a UDF validator and need access to the data properties, you have to do something like this.

       "uniqueEmails": { 
            udf = function( value, target, metadata ) { 
                var data = target.getInternals().data;
                return data.email != data.email2;
            },
            udfmessage = "Type in different emails knucklehead."
        }

To get to the data properties, you have to reference target.getInternals().data.

Provide methods to cleanup up the API, so you can do this instead.

var data = target.getDataProperties();
grantcopley commented 1 year ago

Resolved 2.3.7-snapshot