sKunKbad Posted April 24, 2009 Share Posted April 24, 2009 Honestly, javascript is not my strength, so I'm hoping somebody will point out what is wrong very easily. When I go to my contact form in IE6, I can not type in the fields. My form has an onkeyup event in the form's open tag. The script that checks 3 form fields is this: function validate(){ var realname=document.getElementById("rn").value var email=document.getElementById("addy").value var mesg=document.getElementById("mesg").value var nameIsGood = 'no' var emailIsGood = 'no' var myNameRegex = /^[a-z\s'-]*$/i; var matchPos1 = realname.search(myNameRegex); if (realname != ''){ if (matchPos1 != -1) { document.getElementById("name-status").style.color = '#66cc66' nameIsGood = 'yes' }else{ document.getElementById("name-status").style.color = '#ff0000' nameIsGood = 'no' } }else{ document.getElementById("name-status").style.color = '#ff0000' nameIsGood = 'no' } var myEmailRegex = /^(?:^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|gov|mobi|tv|biz|info|jobs|museum|edu)$)$/i; var matchPos2 = email.search(myEmailRegex); if (email != ''){ if (matchPos2 != -1) { document.getElementById("email-status").style.color = '#66cc66' emailIsGood = 'yes' }else{ document.getElementById("email-status").style.color = '#ff0000' emailIsGood = 'no' } }else{ document.getElementById("email-status").style.color = '#ff0000' emailIsGood = 'no' } var myMesgRegex = /<+|>+/; var matchPos3 = mesg.search(myMesgRegex); if (mesg != ''){ if (matchPos3 == -1 && nameIsGood == 'yes' && emailIsGood == 'yes'){ document.getElementById("button").disabled = '' document.getElementById("notags").innerHTML = '' }else if (matchPos3 != -1){ document.getElementById("button").disabled = 'disabled' document.getElementById("notags").innerHTML = 'Error: No < or > symbols allowed in message body!' }else{ document.getElementById("button").disabled = 'disabled' document.getElementById("notags").innerHTML = 'Either your name or email address is not valid!' } }else{ document.getElementById("button").disabled = 'disabled' document.getElementById("notags").innerHTML = '* All Form Fields Are Required !' } } If you'd like to see what I'm working on in action, go to my website www.brianswebdesign.com, and then go to /test/kohana/contact.php . Sorry, I broke the link in 2 because I don't want to have the link indexed. Thanks for any help. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 24, 2009 Share Posted April 24, 2009 function validate(){ var realname=document.getElementById("rn").value; var email=document.getElementById("addy").value; var mesg=document.getElementById("mesg").value; var nameIsGood = 'no'; var emailIsGood = 'no'; var myNameRegex = /^[a-z\s'-]*$/i; var matchPos1 = realname.search(myNameRegex); if (realname !== ''){ if (matchPos1 !== -1) { document.getElementById("name-status").style.color = '#66cc66'; nameIsGood = 'yes'; }else{ document.getElementById("name-status").style.color = '#ff0000'; nameIsGood = 'no'; } }else{ document.getElementById("name-status").style.color = '#ff0000'; nameIsGood = 'no'; } var myEmailRegex = /^(?:^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|gov|mobi|tv|biz|info|jobs|museum|edu)$)$/i; var matchPos2 = email.search(myEmailRegex); if (email !== ''){ if (matchPos2 !== -1) { document.getElementById("email-status").style.color = '#66cc66'; emailIsGood = 'yes'; }else{ document.getElementById("email-status").style.color = '#ff0000'; emailIsGood = 'no'; } }else{ document.getElementById("email-status").style.color = '#ff0000'; emailIsGood = 'no'; } var myMesgRegex = /<+|>+/; var matchPos3 = mesg.search(myMesgRegex); if (mesg !== ''){ if (matchPos3 == -1 && nameIsGood == 'yes' && emailIsGood == 'yes'){ document.getElementById("button").disabled = ''; document.getElementById("notags").innerHTML = ''; }else if (matchPos3 !== -1){ document.getElementById("button").disabled = 'disabled'; document.getElementById("notags").innerHTML = 'Error: No < or > symbols allowed in message body!'; }else{ document.getElementById("button").disabled = 'disabled'; document.getElementById("notags").innerHTML = 'Either your name or email address is not valid!'; } }else{ document.getElementById("button").disabled = 'disabled'; document.getElementById("notags").innerHTML = '* All Form Fields Are Required !'; } } Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted April 24, 2009 Author Share Posted April 24, 2009 Didn't work for me. I wonder if it has anything to do with the fact that I am using multiple IEs version of IE6. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted April 24, 2009 Share Posted April 24, 2009 the only othere i got was in the regex said unescaped - Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted April 24, 2009 Author Share Posted April 24, 2009 Have you tried to load the page in my original post in IE6? I have regular IE6 at work on a Win2K machine, but at home I only have multiple IEs. Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted April 24, 2009 Author Share Posted April 24, 2009 The problem was with my installation of multiple IEs after installing IE8. I haven't tried to reinstall multiple IEs yet, but will try tonight when I get home. If multiple IEs' IE6 doesn't work after reinstalling, it could mean the end of IE6 support for me. I don't know what other developers do, but it isn't in my budget to have another computer at home, just to run IE6. Yes, I could run a virtual installation of XP on my ubuntu, and it would have IE6, but my computer is dual boot, and it would suck to have to reboot anytime I want to see something in IE6. The browsers in Firefox never seem to have issues, so I don't go to that side when I'm working. Quote Link to comment Share on other sites More sharing options...
.josh Posted April 24, 2009 Share Posted April 24, 2009 We rarely get clients bitching about IE6 incompatibility at the company I work for. But, my dept isn't really far enough up on the totem pole to tell them so the hell what, so we usually do have to cater to it when it comes up. Some of us use http://www.xenocode.com/Browsers/ Some of us use http://www.microsoft.com/downloads/details.aspx?FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677&displaylang=en Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.