views:

30

answers:

1

I have a field in my form which accepts only numbers and I am validating in the below function.

In the function I want to activate the dialog only when the user enter numbers only (no letters). When characters are entered it shold show an error.

$('#submit').click(function(e){
    $("#form").validationEngine({
        inlineValidation: false,
        failure : function() {
            $('input[class*=validate]').each(function(idx, item) {
                if ($.validationEngine.loadValidation('#'+item.id)) {
                    $('#'+item.id).addClass('TextBoxError');

                }
            });
        }

    });
          $("#loader").dialog();
          $("#loader").dialog('open');
          $('#loader').append('</br><img src="/images/abc.gif" border="0" align="middle" hspace="20" vspace="5"/>Searching.. Please wait.');
});
A: 

store the input in a variable and then test:

if (variable == NAN) {...} else {...}

If the statement is true (that is, the variable is NAN--Not A Number), throw up an alert. Otherwise, perform your function in the 'else' block.

Squirkle