You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Don Don <pr...@yahoo.com> on 2007/01/11 16:16:56 UTC

Javascript onfocus issuein IE and struts 1.2.x

  Hi all, 
  I've noticed an issue with the above versions of struts and the javascript onfocus function when using IE.  Struts uses the function in lower case (e.g. "onfocus()") and even renders the generated code in lower case as well, IE on the other hand requires the function to be in this format "onFocus()" where the F is capitalized.  If the F is capitalized the function works in IE but if its uncapitalised e.g. f then it does not function in IE.
  Other browsers seems to work fine, Firefox, etc. 
  Anyway of getting around this ? 
  Cheers 

 
---------------------------------
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.

Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank,

Frank W. Zammetti wrote:
> In which version of IE do you observe this behavior?  I just verified in
> IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. 

Just out of curiosity, what DOCTYPE were you guys using? I know that
XHTML requires that all attributes be entirely in lowercase (i.e.
'onfocus' is correct while 'onFocus' is actually incorrect).

Could this be an issue with quirks mode versus standards compliance mode
in MSIE?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpl2H9CaO5/Lv0PARAlF+AJ9BBnkJ6bP1dM0WemxaoYzQVof2hACfYL9x
J2YwVk0LZE2G20lfG77HkeY=
=grTT
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
I see you guys were two posts ahead of me while I typed my last reply :) 
On the same wavelength though.

If you just throw a simple alert(''); in the event handler instead, in the
fullblown Struts version, do you get the popup as expected?  I'm grasping
at the same pack of straws Christopher is, just trying to narrow the
problem down a tad.

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Thu, January 11, 2007 11:21 am, Don Don wrote:
> Hi I noticed it working in an html only environment (i.e. not struts) when
> struts is applied it fails to work still only in IE
>
> Christopher Schultz <ch...@christopherschultz.net> wrote: -----BEGIN PGP
> SIGNED MESSAGE-----
> Hash: SHA1
>
> Don,
>
> Don Don wrote:
>> in IE (all versions from 5 to 7) this just does not work.
>
> I tried this exact file in MSIE 6.0.2900.2180 and it works just fine
> (after you tell MSIE that it's okay to run scripts from a file you
> grabbed off your own disk):
>
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
>
>
>  [input]
> value="First Name" onfocus="if(this.value=='First Name')this.value='';">
>
>
>
> Mozilla ff renders this same page in standards compliance mode (as you
> would expect, given that DOCTYPE), but can't remember how to tell what
> MSIE is doing with it.
>
> At any rate, it works for me. Do other scripts on your page work as
> well? Perhaps you have a script somewhere else on the page that is
> failing, causing this one never to be run. (??) I'm just grasping at
> straws at this point.
>
> Try the minimal example that you provided on a page all by itself and
> see what happens for you.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpmMW9CaO5/Lv0PARAjxsAKCWPP+RE8b64v/Cq1exCbEkttDYKgCeL8uP
> s9eSOKDB+JbGEkBbrQ9VQ9k=
> =Y75R
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------
> Want to start your own business? Learn how on Yahoo! Small Business.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by Don Don <pr...@yahoo.com>.
Hi I noticed it working in an html only environment (i.e. not struts) when struts is applied it fails to work still only in IE

Christopher Schultz <ch...@christopherschultz.net> wrote: -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don,

Don Don wrote:
> in IE (all versions from 5 to 7) this just does not work.

I tried this exact file in MSIE 6.0.2900.2180 and it works just fine
(after you tell MSIE that it's okay to run scripts from a file you
grabbed off your own disk):


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



 [input] 
value="First Name" onfocus="if(this.value=='First Name')this.value='';">



Mozilla ff renders this same page in standards compliance mode (as you
would expect, given that DOCTYPE), but can't remember how to tell what
MSIE is doing with it.

At any rate, it works for me. Do other scripts on your page work as
well? Perhaps you have a script somewhere else on the page that is
failing, causing this one never to be run. (??) I'm just grasping at
straws at this point.

Try the minimal example that you provided on a page all by itself and
see what happens for you.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpmMW9CaO5/Lv0PARAjxsAKCWPP+RE8b64v/Cq1exCbEkttDYKgCeL8uP
s9eSOKDB+JbGEkBbrQ9VQ9k=
=Y75R
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



 
---------------------------------
Want to start your own business? Learn how on Yahoo! Small Business.

Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don,

Don Don wrote:
> in IE (all versions from 5 to 7) this just does not work.

I tried this exact file in MSIE 6.0.2900.2180 and it works just fine
(after you tell MSIE that it's okay to run scripts from a file you
grabbed off your own disk):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<body>
<input type="text" name="firstName" maxlength="50" size="40"
value="First Name" onfocus="if(this.value=='First Name')this.value='';">
</body>
</html>

Mozilla ff renders this same page in standards compliance mode (as you
would expect, given that DOCTYPE), but can't remember how to tell what
MSIE is doing with it.

At any rate, it works for me. Do other scripts on your page work as
well? Perhaps you have a script somewhere else on the page that is
failing, causing this one never to be run. (??) I'm just grasping at
straws at this point.

Try the minimal example that you provided on a page all by itself and
see what happens for you.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpmMW9CaO5/Lv0PARAjxsAKCWPP+RE8b64v/Cq1exCbEkttDYKgCeL8uP
s9eSOKDB+JbGEkBbrQ9VQ9k=
=Y75R
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hmm, curious... I just tried the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head></head><body>
<input type="text" name="firstName" maxlength="50" size="40" value="First
Name" onfocus="if(this.value=='First Name')this.value='';">
</body></html>

This is working for me just fine, IE 6 and 7 anyway.  I also tried
changing onfocus to onFocus, and it still worked.  I definitely would have
been with Christopher in thinking doctype was the culprit, but this
working both ways seems to imply otherwise.

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Thu, January 11, 2007 10:57 am, Don Don wrote:
> Hi guys here's what am tryin to do
>
> <input type="text" name="firstName" maxlength="50" size="40" value="First
> Name" onfocus="if(this.value=='First Name')this.value='';">
>
> in IE (all versions from 5 to 7) this just does not work.  Maybe as Chris
> said it has to do with the doc type, here's the doctype am using
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> What could be wrong ?
>
>
> "Frank W. Zammetti" <fz...@omnytex.com> wrote: Hi Don,
>
> In which version of IE do you observe this behavior?  I just verified in
> IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine.
> AFAIK, case does not matter to any browser with event handler names,
> whether Struts is involved or not... any chance the problem your seeing is
> caused by something else and it just seems like this is the problem?
> (we've all been there before! LOL)
>
> Frank
>
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: fzammetti@hotmail.com
> Author of "Practical Ajax Projects With Java Technology"
>  (2006, Apress, ISBN 1-59059-695-1)
> Java Web Parts - http://javawebparts.sourceforge.net
>  Supplying the wheel, so you don't have to reinvent it!
>
> On Thu, January 11, 2007 10:16 am, Don Don wrote:
>>   Hi all,
>>   I've noticed an issue with the above versions of struts and the
>> javascript onfocus function when using IE.  Struts uses the function in
>> lower case (e.g. "onfocus()") and even renders the generated code in
>> lower case as well, IE on the other hand requires the function to be in
>> this format "onFocus()" where the F is capitalized.  If the F is
>> capitalized the function works in IE but if its uncapitalised e.g. f
>> then it does not function in IE.
>>   Other browsers seems to work fine, Firefox, etc.
>>   Anyway of getting around this ?
>>   Cheers
>>
>>
>> ---------------------------------
>> Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------
> Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by Don Don <pr...@yahoo.com>.
Hi guys here's what am tryin to do

<input type="text" name="firstName" maxlength="50" size="40" value="First Name" onfocus="if(this.value=='First Name')this.value='';">

in IE (all versions from 5 to 7) this just does not work.  Maybe as Chris said it has to do with the doc type, here's the doctype am using  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

What could be wrong ?


"Frank W. Zammetti" <fz...@omnytex.com> wrote: Hi Don,

In which version of IE do you observe this behavior?  I just verified in
IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. 
AFAIK, case does not matter to any browser with event handler names,
whether Struts is involved or not... any chance the problem your seeing is
caused by something else and it just seems like this is the problem?
(we've all been there before! LOL)

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Thu, January 11, 2007 10:16 am, Don Don wrote:
>   Hi all,
>   I've noticed an issue with the above versions of struts and the
> javascript onfocus function when using IE.  Struts uses the function in
> lower case (e.g. "onfocus()") and even renders the generated code in
> lower case as well, IE on the other hand requires the function to be in
> this format "onFocus()" where the F is capitalized.  If the F is
> capitalized the function works in IE but if its uncapitalised e.g. f
> then it does not function in IE.
>   Other browsers seems to work fine, Firefox, etc.
>   Anyway of getting around this ?
>   Cheers
>
>
> ---------------------------------
> Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



 
---------------------------------
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.

Re: Javascript onfocus issuein IE and struts 1.2.x

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hi Don,

In which version of IE do you observe this behavior?  I just verified in
IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. 
AFAIK, case does not matter to any browser with event handler names,
whether Struts is involved or not... any chance the problem your seeing is
caused by something else and it just seems like this is the problem?
(we've all been there before! LOL)

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Thu, January 11, 2007 10:16 am, Don Don wrote:
>   Hi all,
>   I've noticed an issue with the above versions of struts and the
> javascript onfocus function when using IE.  Struts uses the function in
> lower case (e.g. "onfocus()") and even renders the generated code in
> lower case as well, IE on the other hand requires the function to be in
> this format "onFocus()" where the F is capitalized.  If the F is
> capitalized the function works in IE but if its uncapitalised e.g. f
> then it does not function in IE.
>   Other browsers seems to work fine, Firefox, etc.
>   Anyway of getting around this ?
>   Cheers
>
>
> ---------------------------------
> Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org