teamcfadvance / ValidateThis

An object oriented validation framework for ColdFusion objects
http://www.validatethis.org
44 stars 32 forks source link

Upload Validators #92

Closed jamiejackson closed 8 years ago

jamiejackson commented 8 years ago

I don't know VT (or jQuery validator) all that well, but here's my stab at upload validators.

The gist of my ClientRuleScripter_X.cfc changes were to get generated rules to go from this (broken) format:

    fm['attach_2'] = $(":input[name='attach_2']", $form_frmMain);
    if (fm['attach_2'].length) {
        fm['attach_2'].rules('add', {
             "extension" : 
            {
                "extension" : "pdf"
            },
            "messages" : {
                "extension" : "The defaultMessage_extension"
            }
        });
    }

...to this (working) format:

    fm['attach_2'] = $(":input[name='attach_2']", $form_frmMain);
    if (fm['attach_2'].length) {
        fm['attach_2'].rules('add', {
            "extension" : "pdf",
            "messages" : {
                "extension" : "The defaultMessage_extension"
            }
        });
    }

I don't have automated tests for these, nor did I run regression tests. If you require that, you'll need to let me know what the setup and steps are for that.

I also didn't add any documentation (not sure where that lives now).

Further, I didn't commit samples; however, locally, I've been working in StructureDemo, since that didn't require me to learn the model/BO aspects (yet), and it was one of the samples I was able to get running. If you would like me to commit a sample, please let me know which one is best.

Finally, this has some CFML-engine-based logic branching, and while I've taken a crack at providing Adobe functionality, I've only really tested on Lucee 4.5.2.018.

jamiejackson commented 8 years ago

Hang on, I need to test something.

jamiejackson commented 8 years ago

Okay, done.

jamiejackson commented 8 years ago

Doing some testing on ACF 10.