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


Groups > comp.lang.php > #5091 > unrolled thread

multiple dynamic text fields

Started byhipa <hipa.invalid@telenet.be>
First post2012-03-03 13:32 +0000
Last post2012-03-08 15:46 -0500
Articles 4 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-03 13:32 +0000
    Re: multiple dynamic text fields Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-03 09:07 -0500
      Re: multiple dynamic text fields hipa <hipa.invalid@telenet.be> - 2012-03-08 18:17 +0000
        Re: multiple dynamic text fields Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-08 15:46 -0500

#5091 — multiple dynamic text fields

Fromhipa <hipa.invalid@telenet.be>
Date2012-03-03 13:32 +0000
Subjectmultiple dynamic text fields
Message-ID<jit6gs$fe8$1@speranza.aioe.org>
Hi

I have a page with an autocomplete text field. This works fine. But what 
I actually want is adding more text fields with the same autocomplete 
options. It must be an orderpage with multiple order lines.
If I choose option 2 from the drop down, 2 text fields are chown. That is 
ok, but the autocomplete doesn't work.
But if I manually type "getuser.php?q=2" in a browser I get a page with 2 
text boxes where the autocomplete does work.
I don't think I need to show here my complete autocomplete code because I 
think this is not the point here.
When text boxes are generated dynamically is there an underlying id or 
something given to it? Hope someone can help.

index.php
---------

<!DOCTYPE html>

<html lang="en" >
    <head>
        <meta charset="utf-8" />
        <title>Test</title>
        <link href="css/main.css" rel="stylesheet" type="text/css" />   
	<link href="css/jquery.autocomplete.css" rel="stylesheet" 
type="text/css" />
        <script type="text/javascript" src="js/jquery-1.5.2.min.js"></
script>
        <script type="text/javascript" src="js/
jquery.autocomplete.pack.js"></script>
        <script type="text/javascript" src="js/scriptpg.js"></script>

<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a number:</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</form>
<br />
<div id="txtHint"><b>Number info will be listed here.</b></div>
</body>
</html>

---------------------------------------------------------------

getuser.php
-----------

...

<body>
<?php
$q=$_GET["q"];
for($i=1;$i<=$q;$i++){
echo "<input class='article' type='text' autocomplete='off'><br>";
}
?>
</body>

[toc] | [next] | [standalone]


#5093

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-03-03 09:07 -0500
Message-ID<jit8i7$833$1@dont-email.me>
In reply to#5091
On 3/3/2012 8:32 AM, hipa wrote:
> Hi
>
> I have a page with an autocomplete text field. This works fine. But what
> I actually want is adding more text fields with the same autocomplete
> options. It must be an orderpage with multiple order lines.
> If I choose option 2 from the drop down, 2 text fields are chown. That is
> ok, but the autocomplete doesn't work.
> But if I manually type "getuser.php?q=2" in a browser I get a page with 2
> text boxes where the autocomplete does work.
> I don't think I need to show here my complete autocomplete code because I
> think this is not the point here.
> When text boxes are generated dynamically is there an underlying id or
> something given to it? Hope someone can help.
>
<irrelevant code snipped>

You're in the wrong newsgroup.  Autocomplete is browser-side.  PHP is 
server side.  Try comp.lang.javascript to start.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#5134

Fromhipa <hipa.invalid@telenet.be>
Date2012-03-08 18:17 +0000
Message-ID<jjat42$a5t$2@speranza.aioe.org>
In reply to#5093
Op Sat, 03 Mar 2012 09:07:01 -0500, schreef Jerry Stuckle:

> On 3/3/2012 8:32 AM, hipa wrote:
>> Hi
>>
>> I have a page with an autocomplete text field. This works fine. But
>> what I actually want is adding more text fields with the same
>> autocomplete options. It must be an orderpage with multiple order
>> lines. If I choose option 2 from the drop down, 2 text fields are
>> chown. That is ok, but the autocomplete doesn't work. But if I manually
>> type "getuser.php?q=2" in a browser I get a page with 2 text boxes
>> where the autocomplete does work. I don't think I need to show here my
>> complete autocomplete code because I think this is not the point here.
>> When text boxes are generated dynamically is there an underlying id or
>> something given to it? Hope someone can help.
>>
> <irrelevant code snipped>
> 
> You're in the wrong newsgroup.  Autocomplete is browser-side.  PHP is
> server side.  Try comp.lang.javascript to start.

Hi

My autocomplete isn't browser side. It gets its values from a postgres DB 
on the server. See my post in the group you recommended.

[toc] | [prev] | [next] | [standalone]


#5135

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-03-08 15:46 -0500
Message-ID<jjb5qv$b2p$1@dont-email.me>
In reply to#5134
On 3/8/2012 1:17 PM, hipa wrote:
> Op Sat, 03 Mar 2012 09:07:01 -0500, schreef Jerry Stuckle:
>
>> On 3/3/2012 8:32 AM, hipa wrote:
>>> Hi
>>>
>>> I have a page with an autocomplete text field. This works fine. But
>>> what I actually want is adding more text fields with the same
>>> autocomplete options. It must be an orderpage with multiple order
>>> lines. If I choose option 2 from the drop down, 2 text fields are
>>> chown. That is ok, but the autocomplete doesn't work. But if I manually
>>> type "getuser.php?q=2" in a browser I get a page with 2 text boxes
>>> where the autocomplete does work. I don't think I need to show here my
>>> complete autocomplete code because I think this is not the point here.
>>> When text boxes are generated dynamically is there an underlying id or
>>> something given to it? Hope someone can help.
>>>
>> <irrelevant code snipped>
>>
>> You're in the wrong newsgroup.  Autocomplete is browser-side.  PHP is
>> server side.  Try comp.lang.javascript to start.
>
> Hi
>
> My autocomplete isn't browser side. It gets its values from a postgres DB
> on the server. See my post in the group you recommended.

It may get the data from a database, but the request must still come 
from the browser - which is what your AJAX code is doing.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web