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
CharlesEF
post May 29 2019, 05:55 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Your scripts are using jQuery but you haven't linked to the jQuery library. Once you do that it will work.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
shankar from vizag
post May 29 2019, 07:57 PM
Post #3


Advanced Member
****

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



QUOTE(CharlesEF @ May 30 2019, 04:25 AM) *

Your scripts are using jQuery but you haven't linked to the jQuery library. Once you do that it will work.


Yes, now its working charles Ji

Thank you so much and so kind both of you.

regards
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: 19th April 2024 - 05:38 AM