Detect Characters in String
Hello All
I am currently developing an online email scanning system, but have come across a problem which I was wondering whether someone could help me with.
Basically the site asks a user to copy and paste email headers in to a textarea. This works fine as it is 90% of the time. However, on some ocassions I get error messages (500 Internal server error). The reason for this appears to be the fact that if the header you have pasted in contains ";" halfway across a line, it raises the error.
Unfortunately I cannot get the page the info is submitted to, to detect and repair the problem before the error is raised, as I get the internal error 500 etc. The solution as it stands would appear to be that I have to put in a javascript check on the entry page to ensure it inserts a new line after every ";" in the textarea.
I would really appreciate it if someone could tell me how this is done. I have tried all sorts (Replace etc.) and it still doesn't want to work.
This is the code as it stands at the moment:
Code:
function checkform(){
if(document.forms.Form1.header && document.forms.Form1.header.value =='')
{
alert('You have not entered an email header. Please try again.');
return false;
}
else {
var str = document.forms.Form1.header.value;
str.replace(/;/, '');
return true;
}
}
If you want to check the site as it stands, the address at the moment is www.detect.thehortonfamily.co.uk
Anyone's help would be greatly appreciated.
Best Regards
Tom