Javascript/HTML need a fresh perspective (e-mail form)

[code]<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">



EGCTechServ Request





















EGCTechServ Request

MID:                          

DBA:                          

Test Card # Used:       

Error Msg Displayed:  

Notes:                        

 


function CheckStr(mystr) {
newStr = new String(mystr);
var poundsymbol = /#/g;
var ampersand = /&/g;
var apostrophe = /'/g;
var dash = /-/g;
var space = / /g;
var comma = /,/g;

newStr = newStr.replace(poundsymbol, "%23");
newStr = newStr.replace(ampersand, "%26");
newStr = newStr.replace(apostrophe, "%27");
newStr = newStr.replace(dash, "%2D");
newStr = newStr.replace(space, "%20");
newStr = newStr.replace(comma, "%2C");

return newStr;
}

 





[/code]

I'm looking for a fresh perspective on this. I am still learning javascript, but trying to make something useful. I have added a couple of pre-made scripts to force there to be input on all the fields. I need to find a way to make it so if this occurs, the form cancels so that the e-mail is not generated.

I am thinking of an if statement, but not quite sure how to word it within Javascript to allow it to affect (stop) the onClick event handler of the file from occurring so that the user must click ok on the dialog and then fill any remaining space in and try again.

The output line (if it's not obvious to the reader):

[code]

[/code]

Thanks in advance,

Kyp
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories