Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #12659

Re: multiple dynamic text fields

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From hipa <hipa.invalid@telenet.be>
Newsgroups comp.lang.javascript
Subject Re: multiple dynamic text fields
Date Tue, 13 Mar 2012 20:08:38 +0000 (UTC)
Organization Aioe.org NNTP Server
Lines 103
Message-ID <jjo9g6$9of$1@speranza.aioe.org> (permalink)
References <jivp14$brm$1@speranza.aioe.org> <k3b8l7pp4vorvia9lbtutsmbp780hpdra6@4ax.com> <jjasus$a5t$1@speranza.aioe.org> <r89jl71j687lntrh7q2i2dg7uv4p0710fr@4ax.com> <jjdj6a$5e4$1@speranza.aioe.org> <kisll7hog3lbuv6l7tb2l2ovp9oeivdj5q@4ax.com> <jjias1$aiv$1@speranza.aioe.org> <f4612afd-0c05-42ae-b66c-ba8f797ec901@v22g2000yqm.googlegroups.com>
NNTP-Posting-Host W+krp/PkseaMlJTQ0CYyxA.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Complaints-To abuse@aioe.org
User-Agent Pan/0.133 (House of Butterflies)
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.javascript:12659

Show key headers only | View raw


Op Mon, 12 Mar 2012 20:16:17 -0700, schreef David Mark:

> On Mar 11, 9:55 am, hipa <hipa.inva...@telenet.be> wrote:
>> Op Sat, 10 Mar 2012 17:19:46 +1100, schreef Jeff North:
>>
>> > On Fri, 9 Mar 2012 18:46:34 +0000 (UTC), in comp.lang.javascript hipa
>> > <hipa.inva...@telenet.be>
>> > <jjdj6a$5e...@speranza.aioe.org> wrote:
>>
>> >>| Op Fri, 09 Mar 2012 17:38:23 +1100, schreef Jeff North: | | > In
>> >>your getuser.php file remove all the fluff that is before <?php and |
>> >>> after ?>
>> >>| >
>> >>| > See if that helps.
>> >>|
>> >>| Still the same.
>>
>> > The only think left is there might be an error in the scriptpg.js
>> > file which is causing the non-execution of all the scripts on the
>> > page.
>>
>> I found the problem.
> 
> A problem.
> 
>> I tested it while adding text fields true javascript, that also didn't
>> work. That got me thinking.
> 
> There is no such thing as "true Javascript". If you want to pigeonhole
> scripts, use good/bad qualifiers (e.g. jQuery contains bad Javascript).

Can you explain this one?


>> Everytime I add a text field I need to append .autocomplete. When the
>> autocomplete gets set up when the page loads it will not work on a text
>> field that is dynamically added. So this is what I do.
>>
>> $("#addButton").click(function () {
> 
> document.getElementById('addButton').onclick = function() {

Nothing happens when I click the button.

> Do you really need more than one click listener for this button?
>
>>         var newTextBoxDiv =
>>         $(document.createElement('div')).attr("id",
>> 'TextBoxDiv' + counter);
> 
> 
> var newTextBoxDiv = document.createElement('div'); newTextBoxDiv.id =
> 'TextBoxDiv' + counter;

Also nothing happens when the button is clicked.

> Yes, it's taller, but yours is wider. Also, code in listeners needs to
> be as efficient as possible as they react to user input. The "true"
> version will be about a hundred times faster (and avoids the mysterious
> and misunderstood "attr" method). Far easier to read too. ;)
> 
> 
>>         newTextBoxDiv.html('<label>Article '+ counter
>>         +':</label><input
>> type="text" name="article' + counter + '" id="article' + counter +
>> '">');
> 
> newTextBoxDiv.innerHTML = ...
> 
>>         newTextBoxDiv.appendTo("#TextBoxesGroup");
> 
> document.getElementById('TextBoxesGroup').appendChild(newTextBoxDiv);
> 
> Feel free to write a wrapper for gEBI if you are worried about typing
> (shouldn't be). Will just slow things down, but not nearly to the extent
> that jQuery does. It's one function call vs. hundreds and function calls
> are expensive.
> 

How is that?
And why is jQuery so bad? I find the autocomplete function pretty 
handy :-)


>>         $('#article' + counter + '').autocomplete('datapg.php?
>> mode=sqlarticle', {width: 200, max: 10});
> 
> You'd be better off with no widget at all as anything built atop jQuery
> is highly suspect (it's too slow, not cross-browser and has a terrible
> DOM abstraction layer). If that's unacceptable, hand this part off to
> somebody else (preferably not a jQuery enthusiast).

Oh you explained it :-)
How would someone else do it. I could off course also just cut the jQuery 
part.

> 
>>         counter++;
> 
> That works. :)

Thanks for the reply!

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-04 13:00 +0000
  Re: multiple dynamic text fields Jeff North <jnorthau@yahoo.com.au> - 2012-03-05 14:33 +1100
    Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-08 18:14 +0000
      Re: multiple dynamic text fields Jeff North <jnorthau@yahoo.com.au> - 2012-03-09 17:38 +1100
        Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-09 18:46 +0000
          Re: multiple dynamic text fields Jeff North <jnorthau@yahoo.com.au> - 2012-03-10 17:19 +1100
            Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-11 13:55 +0000
              Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-12 20:16 -0700
                Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-13 20:08 +0000
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 15:36 -0700
                Re: multiple dynamic text fields Andrew Poulos <ap_prog@hotmail.com> - 2012-03-14 10:51 +1100
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 18:12 -0700
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 18:55 -0700
                Re: multiple dynamic text fields Andrew Poulos <ap_prog@hotmail.com> - 2012-03-14 15:05 +1100
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 21:38 -0700
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 21:56 -0700
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 22:49 -0700
                Re: multiple dynamic text fields Andrew Poulos <ap_prog@hotmail.com> - 2012-03-14 17:05 +1100
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-14 00:23 -0700
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 22:06 -0700
                Re: multiple dynamic text fields Andrew Poulos <ap_prog@hotmail.com> - 2012-03-14 17:07 +1100
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-14 00:28 -0700
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-13 22:11 -0700
                Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-14 21:56 +0000
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-14 14:58 -0700
                Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-15 06:27 +0000
                Re: multiple dynamic text fields David Mark <dmark.cinsoft@gmail.com> - 2012-03-14 23:46 -0700

csiph-web