Hello. I don't know anything about writing Javascript, and cannot find anything online that does this.
I want to disable the 'submit' button until at least 3 characters have been entered into the form.
I suspect it must do this via a hidden count, but no idea how to do this. Can anyone please help?
Disable Submit until 3 characters are entered
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Disable Submit until 3 characters are entered
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
- Sofw_Arch_Dev
- Forum Commoner
- Posts: 60
- Joined: Tue Mar 16, 2010 4:06 pm
- Location: San Francisco, California, US
Re: Disable Submit until 3 characters are entered
Simonmlewis,
unfortunately you're probably going to have to learn some Javascript and CSS. You want to leverage the onkeydown event on the input element in question.
That function is going to set the css display property of the aforementioned submit button. You'll use things like
and then set the display css property accordingly. There are more advanced ways of doing this, but they require a basic understanding of JavaScript fundamentals which you should acquire first.
unfortunately you're probably going to have to learn some Javascript and CSS. You want to leverage the onkeydown event on the input element in question.
Code: Select all
<input ... onkeydown="myCharCounter();" .../>
Code: Select all
var obj= document.getElementById( 'mySubmitButtonId');
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Disable Submit until 3 characters are entered
Thanks. I have absolutely not a clue with javascript, so I am not really any further.
What would be useful is if i was shown how to do something, and explain what it is that is being shown.
What would be useful is if i was shown how to do something, and explain what it is that is being shown.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.