getElementsByTagName("input").value); // returnsundefined

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. <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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default Re: getElementsByTagName("input").value); // returnsundefined

    You could try getElementsByID("yourID"). Just give your form tag a unique id.
    Creativ Technologies Guest

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

  7. #6

    Default 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

  8. #7

    Default 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

  9. #8

    Default 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

  10. #9

    Default 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

  11. #10

    Default 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

  12. #11

    Default Re: getElementsByTagName("input").value); // returnsundefined

    getElementById() always works for me.
    envision3d Guest

  13. #12

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139