Hi all in my forms/textareas that I want to validate, how do I call on functions such as this?
function isEmail (s)
{ if (isEmpty(s))
if (isEmail.arguments.length == 1) return defaultEmptyOK;
else return (isEmail.arguments[1] == true);
// is s whitespace?
if (isWhitespace(s)) return false;
// there must be >= 1 character before @, so we
// start looking at character position 1
// (i.e. second character)
var i = 1;
var sLength = s.length;
// look for @
while ((i < sLength) && (s.charAt(i) != "@"))
{ i++
}
if ((i >= sLength) || (s.charAt(i) != "@")) return false;
else i += 2;
// look for .
while ((i < sLength) && (s.charAt(i) != "."))
{ i++
}
// there must be at least one character after the .
if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
else return true;
}
AND THIS?
// Checks to see if a required field is blank. If it is, a warning
// message is displayed...
function ForceEntry(objField, FieldName)
{
var strField = new String(objField.value);
if (isWhitespace(strField)) {
alert("You need to enter information for " + FieldName);
objField.focus();
objField.select();
return false;
}
Calling the function?
This question doesn't make sense to me, you seem to know how to validate a form field but you want to know how to call a function?
Some thing like onBlur="somefunction('this.value')" or onChange(somefunction(this.value,'the name of this field')" ) if you have multiple fields. Or maybe onSubmit?
is it calling the function or passsing the info to it or the actuall function you want help with?
p.s if this sounds wrong I'm sorry I'm not what you would call an expert.
Can't you just let these people be - seems like you get riled too easily!
Well... i certainly regret having said it at this point (although that doesn't change the way I feel about it).
in the future i will try to resist the temptation to "say something".
(it's really amazing though... the people who try to help others here catch all kinds of flak for trying to maintain a certain "respectful" environment where we don't have to feel like we are being used and abused.... yet the one's who make demands and stamp their feet for help are given a free pass every time.
i don't know....maybe it's just time for me to take a self-imposed break from this for a while. it's not my intention to be disrespectful, and maybe i'm failing in my efforts.
my sincere apologies to whoever may be offended by my statements.
k)
Wake up Khaki
Yes maybe to your complete suprise there is actually another world outside the USA if you would open up your eyes just a little. Maybe get away from your PC for just a few seconds, and go outside into the real world, how's that for an idea?
Yes the 2nd post was an accident, as the first post produced an error, I came back to my computer and resubmitted the post, but obviously it has gone through. So why dont you just send me to prison?
Bookmarks