Ik heb een formulier waarbij bepaalde tekens in de invulvelden niet gebruikt mogen worden
Het is een vervolg op item: http://www.helpmij.nl/forum/showthread.php/771695-amp-teken-verwijderen.
ik heb het als volgt op kunnen lossen:
[JS]<SCRIPT LANGUAGE="JavaScript">
//TEKENS VERVANGEN1
function replaceChars(entry) {
out = "?"
add = "";
temp = "" + entry;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.formulier.sub.value = temp;
}
// -->
</script>
<SCRIPT LANGUAGE="JavaScript">
//TEKENS VERVANGEN2
function replaceChars2(entry) {
out = "?"
add = "";
temp = "" + entry;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.formulier.zoekpad.value = temp;
}
// -->
</script>
<SCRIPT LANGUAGE="JavaScript">
//TEKENS VERVANGEN3
function replaceChars22(entry) {
out = "&"
add = "";
temp = "" + entry;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.formulier.zoekpad.value = temp;
}
// -->
</script>[/JS]
Voor elke teken en voor elk invulveld heb ik een script. Dit is een behoorlijke omweg om de tekens uit het formulier te krijgen.
Vraag:
Bestaat er een mogelijkheid om deze scripts te combineren tot één script, zodat deze gebruikt kan worden voor alle invulvelden in het formulier
Het is een vervolg op item: http://www.helpmij.nl/forum/showthread.php/771695-amp-teken-verwijderen.
ik heb het als volgt op kunnen lossen:
[JS]<SCRIPT LANGUAGE="JavaScript">
//TEKENS VERVANGEN1
function replaceChars(entry) {
out = "?"
add = "";
temp = "" + entry;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.formulier.sub.value = temp;
}
// -->
</script>
<SCRIPT LANGUAGE="JavaScript">
//TEKENS VERVANGEN2
function replaceChars2(entry) {
out = "?"
add = "";
temp = "" + entry;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.formulier.zoekpad.value = temp;
}
// -->
</script>
<SCRIPT LANGUAGE="JavaScript">
//TEKENS VERVANGEN3
function replaceChars22(entry) {
out = "&"
add = "";
temp = "" + entry;
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.formulier.zoekpad.value = temp;
}
// -->
</script>[/JS]
Voor elke teken en voor elk invulveld heb ik een script. Dit is een behoorlijke omweg om de tekens uit het formulier te krijgen.
Vraag:
Bestaat er een mogelijkheid om deze scripts te combineren tot één script, zodat deze gebruikt kan worden voor alle invulvelden in het formulier