Hi all, I'm sorry if this has been answered before; it seems simpler
than I'm making it.

I am validating a form field on blur by calling a function
validateField.  This function handles the ajax interaction and passes
the response to another function showIcon, which determines which icon
to display and may or may not display an error message div.

This is all working, but now I want to display only the first form
field on load.  The remainder of the form should display only if the
first field passes muster, so I'd simply like to have my validateField
function return true or false.  What could be simpler?  (a lot,
apparently!)

Here is the function.  Is there an easy way to have it return true/
false?  I don't want to interrupt the normal callback handoff to
showIcon, I just want the calling page to have access to the result.

function validateField(file, field, criteria){
                $("#"+field+" img.ico").attr("src","/images/office/ico-
loading.gif");
                $.get("/gateway/validate-"+file+".cfm",
                                {field: field, value: $("#"+field+" 
input").val(), criteria:
criteria},
                                function(response){
                                        response = eval("("+response+")");
                                        
showIcon(field,response.pass,response.msg);
                        });
        }

Reply via email to