The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> PROBLEM WITH DISABLING SUBMIT BUTTON TILL ALL INPUTS FILLED
shankar from vizag
post May 28 2019, 09:12 AM
Post #1


Advanced Member
****

Group: Members
Posts: 202
Joined: 18-June 13
Member No.: 19,316



Greetings,

I have a form with input fields. I would like to disable submit button till all input fields of the form entered.

I placed the code below and it is not working.

<head>
<script>

$(document).ready(function (){
validate();
$('#notenum, #note_date).change(validate);
});

function validate(){
if ($('#notenum').val().length > 0 &&
$('#note_date').val().length > 0) {
$("input[type=submit1]").prop("disabled", false);
}
else {
$("input[type=submit1]").prop("disabled", true);
}
}

</script>
</head>


<center><table class = "table table-striped table-bordered table-hover table-condensed" >
<tr class="active"><td align="right">Note Number:</td><td><input type = "text" readonly name="notenum"> </td></tr>
<tr><td align="right">Date:</td><td><input type="text" id="myDatepicker" name="note_date" placeholder="Click to pick date" ></td></tr>
</table></center>
<input class ="btn btn-primary" type="submit" id="submit1" name="submit1" value="SAVE" onsubmit='this.disabled = true;'>i


Request to guide me to fix the problem. Thanks in advance.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post May 28 2019, 12:02 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



The first INPUT has no value (also the user can't give it a value since it's READONLY).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 07:33 AM