tags:

views:

27

answers:

2

this is my Beginform and I have buttons in my view..

On document load I am doing disabling my submit button

I am seeing My buttons are Disabled but when I click on Save button still its going to my controler?

please can anybody tell me why its doing like this?

A: 

It seems that the click event still fires on the disabled buttons.

If you can influence the functions that fire, you could do a disabled check in them and return false if the button is still disabled.

Pekka
I did that way too but stil no luck..thanks
kumar
A: 

Use an input of type='button' instead and do a check in the jquery click function of the button to see if it is disabled and submit the form if not. You could also pass a value into a hidden field in order to know what button has been clicked at the controller.

<input type='hidden' id='hdnSave' name='Save' />


$('#btnSubmit').click(function(){
if ($('#btnSubmit').attr('disabled') == false)
{
$('#hdnSave').val('Save');
$('#exc-').submit();
}
});
Bablo