5 Replies - 523 Views - Last Post: 07 May 2013 - 10:34 AM

#1 noahwilson  Icon User is offline

  • New D.I.C Head

Reputation: -8
  • View blog
  • Posts: 26
  • Joined: 06-May 13

how inactive submit button till user not fill the form?

Posted 07 May 2013 - 09:58 AM

Hello Guys,
how inactive submit button till user not fill the form? how can i make it possible, please share your suggestion and feedback.
Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: how inactive submit button till user not fill the form?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,473
  • Joined: 12-June 08

Re: how inactive submit button till user not fill the form?

Posted 07 May 2013 - 09:58 AM

Say that again? I am not following.
Was This Post Helpful? 0
  • +
  • -

#3 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,694
  • Joined: 19-March 11

Re: how inactive submit button till user not fill the form?

Posted 07 May 2013 - 10:15 AM

You want to disable the submit button unless the form is filled out?
Was This Post Helpful? 0
  • +
  • -

#4 geohhot  Icon User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 33
  • Joined: 22-December 12

Re: how inactive submit button till user not fill the form?

Posted 07 May 2013 - 10:18 AM

Use onkeyup event like this
var button = document.getElementById("button");
button.disabled = true;
var textIn = document.getElementById("text");
textIn.onkeyup = function() {
    if (textIn.value == "") {
         button.disabled = true;
         console.log("Disabled");
    } else {
        button.disabled = false;
        console.log("Enabled");
    }
};


You will have to just check if it was changed, and if it is see if there is anything in that field, if it is empty make button inactive, if there is user can submit it, so make it enabled.
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3215
  • View blog
  • Posts: 10,784
  • Joined: 12-December 12

Re: how inactive submit button till user not fill the form?

Posted 07 May 2013 - 10:29 AM

I appreciate that this is just sample code, but I wouldn't use "button" (or "text") as ids.
Was This Post Helpful? 0
  • +
  • -

#6 geohhot  Icon User is offline

  • New D.I.C Head

Reputation: 8
  • View blog
  • Posts: 33
  • Joined: 22-December 12

Re: how inactive submit button till user not fill the form?

Posted 07 May 2013 - 10:34 AM

Oh okay will keep that in mind.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1