dev@woodstock.java.net

Re: [nbusers] document.getElementById no more work in Netbeans 6.0 VWPbeta 2

From: Ratnadeep Bhattacharjee <Ratnadeep.Bhattacharjee_at_Sun.COM>
Date: Thu, 25 Oct 2007 14:49:52 -0400

Looking at your javascript code segment:

    <SCRIPT><![CDATA[
      var field = document.getElementById("form1:field");
      alert(field.id+"="+field.value+", tag="+field.tagName);
    ]]></SCRIPT>

This code probably gets executed before the textField has been added to
the DOM Tree. What you should have is a function with this code and
invoke the function during onLoad().

<head>
<script>
function foo() {
      var field = document.getElementById("form1:field");
      alert(field.id+"="+field.value+", tag="+field.tagName);
}
</script>
</head>
<body onload="foo();" .../>

</body>

-Deep.

Wayne Hu(­J¾Ëºû) wrote:
> Dear Richard,
>
> Attached are my sample program and the different results for both Netbeans VWP 6.0 beta 1 & beta 2.
> May I know where I should put my javascript?
>
>
> Best Regards,
>
> Wayne
>
> -----Original Message-----
> From: Richard.Ratta_at_Sun.COM [mailto:Richard.Ratta_at_Sun.COM]
> Sent: Thursday, October 25, 2007 11:10 PM
> To: Winston Prakash
> Cc: nbusers_at_netbeans.org; Dan Labrecque - Sun Microsystems; dev_at_woodstock.dev.java.net; Wayne Hu(­J¾Ëºû)
> Subject: Re: [nbusers] document.getElementById no more work in Netbeans 6.0 VWPbeta 2
>
> There is not enough information to know for sure, but the biggest issue
> that may
> appear with existing javascript is that ALL javascript that is executed
> MUST only
> be executed in or after the body onload.
>
> This means that if you have a "script" tag inline in the form or anywhere
> that is executed before 'onload' completes, it will fail if it
> references any
> woodstock widget instance.
>
> Our files are loaded in the HEAD element but ALL widget instances for a
> given page will only exist after the body "onload" completes.
>
> That is the only time you can safely reference a woodstock widget instance
> generated from one of our JSP tags. This is the result of a dojo .9 change.
>
> -rick
>
> Winston Prakash wrote:
>
>> Dan/Rick,
>>
>> Do you have an answer for this. Looks like this is a real blocker for
>> this user (filed couple of P1 bugs against VW)
>>
>> Since NB Beta2 uses woodstock build #14, any thing changed recently in
>> this regard.
>>
>> - Winston
>>
>>> Hi, there
>>>
>>>
>>>
>>> In Netbeans 5.5.1 & Netbeans 6.0 VWP beta 1, we can use below javascript to get the value of a component.
>>>
>>>
>>>
>>> var xx = document.getElementById("form1:idxx");
>>>
>>> alert(xx.value)
>>>
>>> However, in Netbeans 6.0 beta 2, it will display "undefined".
>>>
>>> Is it caused by an upgraded Dojo version in Netbeans 6.0 VWP beta 2?
>>>
>>> Any suggestion?
>>>
>>> Best Regards,
>>>
>>> Wayne
>>>
>>> CONFIDENTIALITY NOTE : The information in this e-mail is confidential
>>> and privileged; it is intended for use solely by the individual or
>>> entity named as the recipient hereof. Disclosure, copying,
>>> distribution, or use of the contents of this e-mail by persons other
>>> than the intended recipient is strictly prohibited and may violate
>>> applicable laws. If you have received this e-mail in error, please
>>> delete the original message and notify us by return email or collect
>>> call immediately. Thank you. HTC, Corporation
>>>
>
>
> CONFIDENTIALITY NOTE : The information in this e-mail is confidential and privileged; it is intended for use solely by the individual or entity named as the recipient hereof. Disclosure, copying, distribution, or use of the contents of this e-mail by persons other than the intended recipient is strictly prohibited and may violate applicable laws. If you have received this e-mail in error, please delete the original message and notify us by return email or collect call immediately. Thank you. HTC, Corporation
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net