View Full Version : "Required field(s) validation" Quirk/Bug in Chrome

04-27-2012, 01:22 PM
1) Script Title: Required field(s) validation

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/requiredcheck.htm

3) Describe problem: On Google Chrome (not sure about other browsers) there appears to be a single extra "stray" character, appearing as a black box square, after the text of the last field on the ALERT dialog box. This is present even in the demo of the script running on DD.

I cannot for the life of me figure out where this one weird extra char is coming from in the script. Can anyone help? I will post a screen cap showing this on my computer if needed...

{Edit} Hmm, strange... I tested on a different computer also with Chrome but it's okay there! Here is a screenshot, file attached OneChar.jpg of what I am seeing on MY system...

04-29-2012, 08:34 AM
Hmm on my version of Chrome (Win 7) I don't see the extra character either. Does it occur at the end of the message regardless of what the last empty field is? In the screenshot it's after the "age" field...

04-30-2012, 01:18 PM
It always occurs at the END, regardless of which field is the last empty one.

I'm seeing it on an older version of Chrome (12.0.742.91 I believe) that is running as a "Portable App" on my laptop (hence why it has not auto-updated).

So maybe this is not a problem IF it's just due to my Chrome being out of date. But I'd still like to fix it anyway if possible to do so in MY code, rather than depend on it to be fixed by whatever browser some user may be on in the future.

05-01-2012, 11:54 PM
Ok, try changing the line:


inside the script to:

alert(alertMsg.replace(/\s*$/, ""));

It removes any white space from the end of the output message, which that strange block could be one of.

05-02-2012, 04:17 PM
That worked... thanks!

But any downside to this bit of code, i.e. any chance it will cause some worse problem than fixing this little cosmetic quirk?

Should I use it really OR maybe just leave the script alone and live with the quirk? LOL


05-03-2012, 08:06 AM
There's no potential downside other than the slight overhead in terms of efficiency compared to the original line.

05-04-2012, 03:12 PM
OK, great. Thanks so much for the help :)