473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.innerHTML + 'bla').update(td.innerHTML + in2)

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

td.update(in1.innerHTML + '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
Jun 27 '08 #1
4 1665
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('input', ...), Builder.node('input',...), '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.innerHTML + 'bla').update(td.innerHTML + in2)

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

td.update(in1.innerHTML + '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
Jun 27 '08 #2
The Prototype mailing list: http://groups-beta.google.com/group/...rails-spinoffs

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

- JDD
Jun 27 '08 #3
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!
Jun 27 '08 #4
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.innerHTML + 'bla').update(td.innerHTML + in2)

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

td.update(in1.innerHTML + '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>
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: pb648174 | last post by:
I have a single update statement that updates the same column multiple times in the same update statement. Basically i have a column that looks like .1.2.3.4. which are id references that need to...
2
by: Jason Keirstead | last post by:
Is there a way I can add a setter/getter to the HTMLElement prototype in internet explorer? This, for example, works fine in Mozilla: HTMLElement.prototype.__defineSetter__("foobar", function...
12
by: petermichaux | last post by:
Hi, I've been reading the recent posts and older archives of comp.lang.javascript and am surprised by the sentiments expressed about the prototype.js library for a few reasons: 1) The library...
45
by: bigdadro | last post by:
I've created a new class using prototype.js. After I make the ajax.request all references to this.myClassMethodorVariable are lost. Does the ajax method blow out the object persistance? I'm fairly...
2
by: hardrock | last post by:
Hello! I'm working with the prototype library version 1.4.0 and having a strange error lately. When I want to make an Ajax.Updater call, it basically works. But as soon as I put the call into...
17
by: Steve-O | last post by:
The following code works great in FireFox, Opera, Netscape, Safari, and Gecko, but NOT IE. Why? I tried using 'native' js with setInterval and setTimeout, but I get the same result. My IE...
1
by: MORALBAROMETER | last post by:
Hi all, I want to update MULTIPLE elements of an HTML page using Ajax. for this reason i my response is an xml document. I want to use XSL at the client side to update these elements. How can i...
6
by: cbare | last post by:
Hello JS Gurus, One thing I haven't figured out about javascript is the treatment of __proto__. Inheritence, whether prototypes or class-based, is just a shorthand form of delegation (leaving...
2
by: hotflash | last post by:
Hi Master CroCrew, I found a good PURE ASP that will allow you to upload 10MB file to the server and the file contents such as Network, Author, Title, etc... will insert to MS Access at the same...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.