Topic: Trying to extend Rename functionality
Hi,
I thought this would be easy, but I've failed miserabley. I am trying to extend the rename facility so that I can, for example, strip out certain characters or replace them with other characters. I already have the functions written and thought it would be easy just to extend the Rename function and hand it back to you with a Ta Da!! - Sorry - I failed ![]()
The function:
function RemoveInvalidChars(theinput, pattern) {
reg = new RegExp(pattern, 'g');
newstring = theinput.value.replace(reg, '');
// only update the input if invalid chars have been replaced
// to avoid annoying behavior (e.g. moving cursor to end of text)
if (newstring != theinput.value) {
theinput.value = newstring;
}
return true;
}
Could you show me how I could add this to your rename function. I can then add the 3 other functions and send back to.
many thanks
Peter