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

#1 noahwilson   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   User is online

  • Suitor #2
  • member icon



Reputation: 14045
  • View blog
  • Posts: 56,201
  • 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   User is offline

  • Beginner
  • member icon


Reputation: 11041
  • View blog
  • Posts: 18,857
  • 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   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   User is offline

  • blow up my boots
  • member icon

Reputation: 6544
  • View blog
  • Posts: 26,531
  • 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   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