Hi, I need some help how can i add space if i will input numbers in textfield,I want that if the user will input 888 it will add space directly after the last 8 then if he will continue to add 4 digits 5555 it will add space after the last digit 5,can you help me please how can i achieve this.
Having read your code, it might be better to first take a step back and tell us what you are trying to achieve.
Obviously the user should input something, but what are the possible permutations?
Is text allowed, are numbers allowed?
What is it that the user is inputting? A serial number?
I am submitting my form via jquer.ajax,and in my adduser.php i made some serverside validation with my fields if there is a problem or an error the returned in my ajax will alert the error message.my question for this is this still prawn to tampering even though the returned error came from my server side ?
var serializeform = $('#myform').serialize();
$.ajax({
type: 'post',
data: serializeform,
url: "adduser.php",
success: function(data){
if(data=="ok"){
//some of my script here.
}
else
alert(data);
}
});
For example, imagine you wanted to extend the String class by a function that determined whether a given string contained a vowel.
You could do it like this:
String.prototype.containsVowel = function() {
return this.match(/[aeiouAEIOU]/);
}
if("Pfffttth!".containsVowel()){
console.log("Vowel found!");
} else {
console.log("No vowels here. Move along!");
}
words = ["cat", "Dog", "rbbt", "fi$h", "xxxxxxxxxxx", "Pullo"];
words.map( function(word) {
if (word.containsVowel()){
console.log("Vowel found in " + word);
}
});
It’s not prone to tampering if you check the input on the server.
However, if you rely solely on JS to display the errors, then anyone with JS turned off won’t know why their form didn’t submit if they don’t fill it out correctly.
Hi pullo, if the user will turn of the JS,what i want is that my server validation will take place,i mean it will prompt to the user so that the user will know there is an error in the form.,but i was worried my code because i am submitting the form through jquery.ajax,and i could not display the error message which is validated from the server…
Just to elaborate on what I was saying though, in a perfect world you would create your form first and make sure that it submits properly.
Then you would add the AJAX functionality on top of that.