Where i am doing wrong in this?

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-06-06T03:49:27Z Indexed on 2010/06/06 3:52 UTC
Read the original article Hit count: 303

Filed under:
<script type="text/javascript">
    $(document).ready(function() {

    $('#PbtnSubmit').attr('disabled', 'disabled');
    $('#PbtnCancel').attr('disabled', 'disabled');

        $('#PbtnSelectAll').click(function() {
            $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked');
            $('#PbtnSubmit').removeAttr('disabled');
            $('#PbtnCancel').removeAttr('disabled');
            $('fieldset').find("input,select,textarea").removeAttr('disabled');
        });
        $('#PbtnCancel').click(function() {
            $('#PricingEditExceptions input[name=PMchk]').attr('checked', false);
            $('#PbtnSubmit').attr('disabled', 'disabled');
            $('#PbtnCancel').attr('disabled', 'disabled');
            $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled', 'disabled');
            $('#genericfieldset').find("input,select,textarea").removeAttr('disabled');
        });

        $('#PbtnSubmit').click(function() {
            $('#PricingEditExceptions input[name=PMchk]').each(function() {
                if ($("#PricingEditExceptions input:checkbox:checked").length > 0) {
                    var checked = $('#PricingEditExceptions input[type=checkbox]:checked');
                    var PMstrIDs = checked.map(function() {
                        return $(this).val();
                    }).get().join(',');
                    $('#1_exceptiontypes').attr('value', exceptiontypes)
                    $('#1_PMstrIDs').attr('value', PMstrIDs);
                } else {
                    alert("Please select atleast one exception");
                    return false;
                }
            });
        });
        function validate_excpt(formData, jqForm, options) {
            var form = jqForm[0];
        }
        // post-submit callback 
        function showResponse(responseText, statusText, xhr, $form) {

            if (responseText[0].substring(0, 16) != "System.Exception") {
                $('#error-msg-ID span:last').html('<strong>Update successful.</strong>');
            } else {
                $('#error-msg-ID span:last').html('<strong>Update failed.</strong> ' + responseText[0].substring(0, 48));
            }
            $('#error-msg-ID').removeClass('hide');
        }

        $('#exc-').ajaxForm({
            target: '#error-msg-ID',
            beforeSubmit: validate_excpt,
            success: showResponse,
            dataType: 'json'
        });
        $('.button').button();
    });
</script>

This is my button..

at very first when page load I am trying Make Disabled PbtnSubmit and PbtnCancel and when we click PbtnSelectAll I am enabling back again.. but its not doing with this code. is that something I am doing worng in this?

thanks

© Stack Overflow or respective owner

Related posts about jQuery