Form Helper Demo

Correct Login Info

Username: form_helper
Password: example

Login

The Code

$(function() {
    $("input").textReplacement({
        'activeClass': 'active',
        'dataEnteredClass': 'data_entered'
    });
    
    $("#the_form").scaffoldAjax({
        'dataType': "json",
        'success': function(data) {
            $(".status").addClass(data.class).html(data.message);
        },
        'validate': validate
    });
});

function validate() {
    var un = $("#username").val();
    var pw = $("#password").val();
    var error = "Please enter a username and password";
    
    if(un == "Username" || un == "" || pw == "Password" || pw == "") {
        $(".status").html(error).addClass('error').removeClass('success');
        return false;
    }
    
    $(".status").removeClass('error');

    return true;
}
				
Back to post