New Method Idea for qForms--Conditional Processing...

Posted by Dan on Jul 5, 2005 @ 6:22 PM

Last night I was thinking about the changes I had made to the createDependencyTo() method and started thinking that there might be times when you'd want to do something similiar, but instead of having one field affect another in some manor you'd define a rule for a field if it meets a given condition.

My basic thought would be to add a new method you could call. I've been tossing around the idea of setActionRule(), setConditionAction() or setConditionalRule(). Something along those lines. The idea would be that if the value of the field this method was attached to equal a condition supplied, a function would be triggered.

    function (sValue){
        alert("You have selected to recieve the newsletter in " + sValue + " format.");

This new method would be triggered anytime and it would pass in the current field value as an argument to the function you pass to the new method.

This would allow you to do all sort of cool stuff, such as hiding/showing layers based upon the value of the form field. You could even use it to populate the rest of a form using the setFields() method.

Do you like this idea? If so, what name do you like the best? I'm open to naming suggestions. What other types of things could you see doing w/a method like this?

Categories: JavaScript, qForms, HTML/ColdFusion

Comments for this entry have been disabled.