Prototype: Update with multiple elements and texts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Loose

    Prototype: Update with multiple elements and texts

    Hi,

    I am new to prototype.js and appreciate it a lot.

    One simple thing however seems to be impossible? I have a <tdelement
    which I want to fill with
    - an input field
    - text
    - another input field

    at one step.

    i.e.
    td = ... (simply the <tdelement)
    in1 = new Element('input' , ...)
    in2 = new Element('input' , ...)

    Now none of these works: (because in some cases, the element itself is
    printed, not its content)

    td.update(in1). update(td.inner HTML + 'bla').update(t d.innerHTML + in2)

    td.update(in1 + 'bla' + in2)

    td.update(in1.i nnerHTML + 'bla' + in2.innerHTML)

    ....so what *does* it?

    (or simply: how do I get the content of a new, not-yet-written,
    element?)

    Thx!


    *************

    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]

    If you wish to email me, please use newsreply at wuwei minus webservices dot de
  • Keith Hughitt

    #2
    Re: Prototype: Update with multiple elements and texts

    Hi Marty,

    If you are using script.aculo.us , try checking out Builder.node and
    Builder.build. Using Builder.node
    you can do things like:

    var td = Builder.node ('td', {style: '...'},
    [Builder.node('i nput', ...), Builder.node('i nput',...), 'some plain
    text, etc.']);

    and Builder.build can even acccept entire xhtml fragments.


    On Jun 4, 10:14 am, Daniel Loose <gruenwiesl...@ web.dewrote:
    Hi,
    >
    I am new to prototype.js and appreciate it a lot.
    >
    One simple thing however seems to be impossible? I have a <tdelement
    which I want to fill with
    - an input field
    - text
    - another input field
    >
    at one step.
    >
    i.e.
    td = ... (simply the <tdelement)
    in1 = new Element('input' , ...)
    in2 = new Element('input' , ...)
    >
    Now none of these works: (because in some cases, the element itself is
    printed, not its content)
    >
    td.update(in1). update(td.inner HTML + 'bla').update(t d.innerHTML + in2)
    >
    td.update(in1 + 'bla' + in2)
    >
    td.update(in1.i nnerHTML + 'bla' + in2.innerHTML)
    >
    ...so what *does* it?
    >
    (or simply: how do I get the content of a new, not-yet-written,
    element?)
    >
    Thx!
    >
    *************
    >
    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]
    >
    If you wish to email me, please use newsreply at wuwei minus webservices dot de

    Comment

    • jdalton

      #3
      Re: Prototype: Update with multiple elements and texts

      The Prototype mailing list: http://groups-beta.google.com/group/...rails-spinoffs

      //probably the easiest way
      $('myTD').inser t('Phone number: <input type="text" name="areacode"
      maxlength="3" /- <input type="text" name="phonenumb er" />');

      - JDD

      Comment

      • dhtml

        #4
        Re: Prototype: Update with multiple elements and texts

        On Jun 4, 7:14 am, Daniel Loose <gruenwiesl...@ web.dewrote:
        >
        One simple thing however seems to be impossible? I have a <tdelement
        which I want to fill with
        - an input field
        - text
        - another input field
        >
        at one step.
        >
        What is wrong with innerHTML?
        Thx!

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: Prototype: Update with multiple elements and texts

          Daniel Loose wrote:
          I am new to prototype.js and appreciate it a lot.
          I am not and I do not. Exactly because you are new to it you are in no
          position to assess its quality. Prototype.js is considered junk around here.
          One simple thing however seems to be impossible? I have a <tdelement
          which I want to fill with
          - an input field
          - text
          - another input field
          >
          at one step.
          >
          i.e.
          td = ... (simply the <tdelement)
          in1 = new Element('input' , ...)
          in2 = new Element('input' , ...)
          The declaration for the Element constructor would overwrite the object built
          into Gecko-based UAs. At least it would attempt to, we are talking host
          objects here.
          Now none of these works: (because in some cases, the element itself is
          printed, not its content)
          >
          td.update(in1). update(td.inner HTML + 'bla').update(t d.innerHTML + in2)
          >
          td.update(in1 + 'bla' + in2)
          >
          td.update(in1.i nnerHTML + 'bla' + in2.innerHTML)
          >
          ...so what *does* it?
          >
          (or simply: how do I get the content of a new, not-yet-written,
          element?)
          A new element does not yet have content. `input' elements in particular
          always have EMPTY content, or no content at all if you will.
          [...]
          If you wish to email me, please use newsreply at wuwei minus webservices dot de
          There is the Reply-To header for this.


          PointedEars
          --
          Use any version of Microsoft Frontpage to create your site.
          (This won't prevent people from viewing your source, but no one
          will want to steal it.)
          -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

          Comment

          Working...