I actually had an error message appear next to the field to tell them they were entering wrong data on the spot. Not that it matters now since im not using the onkeypress anymore hehe.
That was also my logic behind it svidgen, basically if i dont want them to use rogue characters in a username then if the keystroke doesnt work they would know immediately rather than later. I dont...
Im actually already detecting for errors at the point that they click the submit button (before submission though) so i guess i could use an onBlur/change instead of the onkeyup/down. This...
I actually had it in an array the first time however you will still have to cater for things like "CTRL+A", "SHIFT+left arrow", "SHIFT+right arrow" etc. This if ofcourse if you are using...
Hi again,
Ok after testing the code unfortunately svidgen your code does not work. The reason being is that if you do:
if (typedChar.match(/[0-9]/)) { //this is only an example if i was using...
Thanks both for the reply,
Fang you would be suprised how many people just type junk into form fields (I have a large database of members to prove this) so the idea is just to prevent random things...
What i need is something as such (based on previous thread): I have a textfield and i want to limit the input to only numbers, letters and caps.
So the code is:
<input onkeydown="return...
Thanks Kor, i was actually using this website alot to test for certain keys but when i read the special keys section i didnt realise other keys like arrow keys would also cause problems too.
Cheers...
Ah right your using onkeydown whereas im using onkeypress that explains it, is it preferable to use the onkeydown instead? (Im just getting mixed up as to which one should be used where).
I did that before however i ran into a problem, using your code if you allow the 37 keycode (for left arrow) then you are also allowing the "%" character aswell because it has a charCode of 37 and...
Hi Fang,
Thank you for that, however if i needed to allow say for example only letters to be input in a field (including things like backspace, left arrow, right arrow, space) am i right in saying...
Is there any way to detect a key being pressed in the window? I have tried the following but it doesnt work:
document.onkeyup = KeyCheck;
function KeyCheck()
{
var keyID = event.keyCode; ...
My question is not how i can get it to execute via page loading or onChange, it is about actually doing what im asking, which is how do i make a drop down the same as another. How this code gets...
Sorry Gullanian but did you actually read the question i posted? This has nothing to do with onChange, as soon as the page loads i want the select to be the same as the other i.e. exactly the same...
Nap, still says undefined. Isnt it becoz the page has already rendered with the content? Although even that doesnt make alot of sense to me becoz javascript executes from top to bottom so the...
Hey Declan no need to apologise I know you werent being rude or anything :), I hope i wasnt either, I always appreciate ppl giving free time to help out. Ok so I have 2 pages again: test.html has:
...