I want to attach a function to my submit button. But my code doesn't seem to be calling the function.
Basically what I want it to do is, enabling all disabled field when the form is being submitted.
This below is my code:
<script>
function enableField() {
$("#Booking_clientPackagedService_id").prop("disabled", false);
}
</script>
<?php
echo CHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
This #Booking_clientPackagedService_id
initially is disabled after certain action being done. But when I click on submit, I would like to enable the field. How can I do it? Please advise, thanks! :D
EDIT
So I've removed onclick
event on my submit button and added as per Kancho Iliev's comment.
$( "#booking-form" ).submit(function() {
$("#Booking_clientPackagedService_id").prop("disabled", false);
});
But it is still not working. Where have I missed out?