Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
srowe3 #1
getElementsByTagName("input").value); // returnsundefined
Please help! The DW API function, getElementsByTagName() doesn't return any
values.
I'm defining the following form as part of an Insert bar extension:
(skipping the usual head stuff)
<body onLoad="reportLabel()">
<form>
<table border="0" height="100" width="100">
<tr valign="baseline">
<td align="left" nowrap>
Some label:
<input type="text" name="label_field" value="" id="alabel">
</td>
</tr>
</table>
</form>
</body>
</html>
And the following JavaScript:
function reportLabel() {
// Read current document's Label meta tag
var dom = dw.getDocumentDOM(); // get the dom of the current document
var label = dom.getElementsByTagName("meta");
for ( counter = 0; counter < label.length; counter++)
{
if (label[counter].name == "Label")
// alert(label[counter].content); // this works, the function reads the
user's document elements just fine
// But how do I find the input field of the extension form so that I can
prepopulate it with the label???
// alert(document.getElementById("alabel").name); // function not defined,
grrr
// alert(document.getElementsByTagName("input").value ); // returns
undefined ---> this is the function I want to use
// alert(document.hasChildNodes()); // returns true, so the document DOM is
readable
// alert(document.childNodes.length); // returns 2
// alert(document.forms.length); // returns 1
// alert(document.forms.childNodes.length); // childNodes has no properties
}
}
Thanks!
-Scott
srowe3 Guest
-
could not read block 84253 of relation "tablename": Input/outputerror
Hi: No way to access "tablename". Can I do something to recover? Is this a hardware error? PostgreSQL 7.4.5 on i686-pc-linux-gnu, compiled by... -
<input type="image"... based custom control
I have created one of these controls but arent getting any call backs. I've got the source from the MSPress book "Developing Microsoft ASP.NET... -
Problem with fopen("php://input", "r")
Hello there, I am having problem opening the in-built php stream php://input According to the manual this has been integrated into php since... -
problem with reset/clear in <input type="file" >
how to clear values in input file object. In My Form i need to upload a file and enter some values in other text fields. i have "Submit" and... -
Saving "Check mark Forms" input in reader
I created some "check mark" forms in 6.0 that I want people with Reader to fill out and save to their drive. But when I open it up in Reader 5.0 and... -
Creativ Technologies #2
Re: getElementsByTagName("input").value); // returnsundefined
You could try getElementsByID("yourID"). Just give your form tag a unique id.
Creativ Technologies Guest
-
srowe3 #3
Re: getElementsByTagName("input").value); // returnsundefined
Does that work for you? The JavaScript function getElementById() is not represented in the API, and when I try it, the return is "function not defined". Thanks for chipping in.
-Scott
srowe3 Guest
-
E Michael Brandt #4
Re: getElementsByTagName("input").value); // returns undefined
getElementsByTagName() returns an ARRAY - so you can not use a dot
operator on it as you have. You have to do, for example:
getElementsByTagName('INPUT')[0].value etc
emichael brandt
srowe3 wrote:> Please help! The DW API function, getElementsByTagName() doesn't return any
> values.
>
> I'm defining the following form as part of an Insert bar extension:
>
> (skipping the usual head stuff)
> <body onLoad="reportLabel()">
> <form>
> <table border="0" height="100" width="100">
> <tr valign="baseline">
> <td align="left" nowrap>
> Some label:
> <input type="text" name="label_field" value="" id="alabel">
> </td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>
> And the following JavaScript:
>
> function reportLabel() {
>
> // Read current document's Label meta tag
> var dom = dw.getDocumentDOM(); // get the dom of the current document
> var label = dom.getElementsByTagName("meta");
> for ( counter = 0; counter < label.length; counter++)
> {
> if (label[counter].name == "Label")
> // alert(label[counter].content); // this works, the function reads the
> user's document elements just fine
>
> // But how do I find the input field of the extension form so that I can
> prepopulate it with the label???
>
> // alert(document.getElementById("alabel").name); // function not defined,
> grrr
> // alert(document.getElementsByTagName("input").value ); // returns
> undefined ---> this is the function I want to use
> // alert(document.hasChildNodes()); // returns true, so the document DOM is
> readable
> // alert(document.childNodes.length); // returns 2
> // alert(document.forms.length); // returns 1
> // alert(document.forms.childNodes.length); // childNodes has no properties
> }
> }
>
> Thanks!
> -Scott
>
>E Michael Brandt Guest
-
envision3d #5
Re: getElementsByTagName("input").value); // returnsundefined
Yes it does work for me. It is just a DOM javascript function and it is not part of the API. You may need to use document.getElementByID. Oyou can just google it to learn more about it.
envision3d Guest
-
srowe3 #6
Re: getElementsByTagName("input").value); // returnsundefined
Thanks EMB!
By the way, envision3d, getElementByID() absolutely does not work. The error message reads, "...document.getElementByID is not a function."
I appreciate the help from all!
-Scott
srowe3 Guest
-
E Michael Brandt #7
Re: getElementsByTagName("input").value); // returns undefined
That is correct, it is NTO defined in the DW API. Instead you might use
dwscripts.findDOMObject()
emichael brandt
srowe3 wrote:> Thanks EMB!
>
> By the way, envision3d, getElementByID() absolutely does not work. The error message reads, "...document.getElementByID is not a function."
>
> I appreciate the help from all!
>
> -Scott
>E Michael Brandt Guest
-
Randy Edmunds #8
Re: getElementsByTagName("input").value); // returns undefined
Scott,
We added document.getElementById() to the DW API in CS3. Note that the
method name is case-sensitive (you had "ID" instead of "Id").
Hope this helps,
Randy
> By the way, envision3d, getElementByID() absolutely does not work. The error message reads, "...document.getElementByID is not a function."Randy Edmunds Guest
-
E Michael Brandt #9
Re: getElementsByTagName("input").value); // returns undefined
Hey that's great. Is there a list of added functions somewhere?
emichael
Randy Edmunds wrote:> Scott,
>
> We added document.getElementById() to the DW API in CS3. Note that the
> method name is case-sensitive (you had "ID" instead of "Id").
>
> Hope this helps,
> Randy
>
>>> By the way, envision3d, getElementByID() absolutely does not work. The
>> error message reads, "...document.getElementByID is not a function."E Michael Brandt Guest
-
Randy Edmunds #10
Re: getElementsByTagName("input").value); // returns undefined
emichael,
You can find the DW CS3 new livedocs here:
DW API Reference:
[url]http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/index.html[/url]
Extending DW:
[url]http://livedocs.adobe.com/en_US/Dreamweaver/9.0_Extending/index.html[/url]
In the DW API Reference, in the Introduction section you'll find "New
Functions in Dreamweaver CS3". Unfortunately, I don't seem to see
document.getElementById() listed, so be sure to go through each of the
sections.
Hope this helps,
Randy
> Hey that's great. Is there a list of added functions somewhere?
>>> We added document.getElementById() to the DW API in CS3. Note that the
>> method name is case-sensitive (you had "ID" instead of "Id").Randy Edmunds Guest
-
envision3d #11
Re: getElementsByTagName("input").value); // returnsundefined
getElementById() always works for me.
envision3d Guest
-
E Michael Brandt #12
Re: getElementsByTagName("input").value); // returns undefined
okay, excellent. thanks.
emichael
Randy Edmunds wrote:> emichael,
>
> You can find the DW CS3 new livedocs here:
>
> DW API Reference:
> [url]http://livedocs.adobe.com/en_US/Dreamweaver/9.0_API/index.html[/url]
>
> Extending DW:
> [url]http://livedocs.adobe.com/en_US/Dreamweaver/9.0_Extending/index.html[/url]
>
> In the DW API Reference, in the Introduction section you'll find "New
> Functions in Dreamweaver CS3". Unfortunately, I don't seem to see
> document.getElementById() listed, so be sure to go through each of the
> sections.
>
> Hope this helps,
> Randy
>
>>> Hey that's great. Is there a list of added functions somewhere?
>>>>> We added document.getElementById() to the DW API in CS3. Note that
>>> the method name is case-sensitive (you had "ID" instead of "Id").E Michael Brandt Guest



Reply With Quote

