473,324 Members | 2,179 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,324 software developers and data experts.

query using textbox value selected

110 100+
Hi,
I'm using scriptaculous autocomplete for my text box and it works perfectly ok
i have made server.php for fetching the values in the ul list and it is shown correctly on the main form but after selection of the value from the text box i want to query my database further for some more details depending on that value

but i don't get any records although my table has records.
if i alert ar values in showcode function it shows rows with values correctly but doesnt show int he div container
if itry to create that table in the main form taking the values of $c_cde it and then create rows of the existing data it doesnt show any rows
instead of generating the rows int he server.php
because it doesnt get $c_Cde value there i checked alerting it


where am i going wrong
my code goes here
[PHP]<form method="get">
<table id="tbl">
<tr>
<td bordercolor="#669999">
<label><strong><font size="3">Select country</strong></label></td>
<td colspan="11" bordercolor="#669999">
<input type="text" c_name="c_name" id="c_name" size="40" class="dlight" autocomplete="off" onblur="showCode(this.value);">
<div id="hint"></div>
<script type="text/javascript">
new Ajax.Autocompleter("c_name","hint","server.php");
</script>
<input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" >
<div id="tbl1"></div>
<tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode?>"></td>
<td><input type="text" name="continent" id="continent" value="<?=$mcontinent?>"></td></tr>
</table>
</form>[/PHP]

and my server.php if as follows


[PHP]<?php
include("../include/con.php");
$sql = "select c_code,c_name from countrymaster where c_name like '%" . $_GET['c_name'] . "%'";
$rs = $DB_site->query($sql);
?>
<ul>
<? while($data = $DB_site->fetch_array($rs)) { ?>
<li><? echo stripslashes($data['c_name']."-".$data['c_cde']);
?></li>
<? } ?>
</ul>
<?
if($_GET['c_name']!=""){
$mc_name=$_GET['c_name'];
$mc_cde=$_GET['c_cde'];
echo "|".$mc_cde."|";
}
$sql1="select * from countrydetails where c_cde='".$mc_cde."'";
$db_query_pricelist=$DB_site->query($sql1);
while($rs=$DB_site->fetch_array($db_query_rs)){
$misdcode=$rs[isdcode'];
$mcontinent=$rs['continent'];
?>
<tr><td><?=$misdcode;?></td>
<td><?=$mcontinent;?></td>
</tr>
<? } ?>[/PHP]





in showcode function
Expand|Select|Wrap|Line Numbers
  1. function showCode(str){ 
  2. c_name=str.substr(0,str.indexOf("-"));
  3. c_cde=str.substr(str.indexOf("-")+1);
  4.     xmlHttp=GetXmlHttpObject();   
  5.     if (xmlHttp==null){
  6.          alert ("Browser does not support HTTP Request");
  7.          return;
  8.      }
  9.     var url="server.php"; 
  10.     url=url+"?c_cde="+c_cde+"&c_name="+c_name;    url=url+"&sid="+Math.random(); 
  11.     xmlHttp.onreadystatechange=function(){stateChanged()} ; 
  12.     xmlHttp.open("GET",url,true);  
  13.     xmlHttp.send(null);
  14. }
  15.  
  16. function stateChanged() { 
  17. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  18.  { 
  19.     var ar=xmlHttp.responseText.split("|");
  20.    al=ar.length;
  21.    document.getElementById("c_cde").value=ar[1] ;
  22.       document.getElementById("tbl1").innerHTML=ar[2] ;
  23.    }
  24. }
Oct 3 '07 #1
30 3232
dmjpro
2,476 2GB
Is your PHP page returning the values as running separately?

Kind regards,
Dmjpro.
Oct 3 '07 #2
SSG001
110 100+
yes
country code and country name are shown in the php main program in the text box

but if i try to query after that in the same program taking country code it doesnt fetch any records
Oct 3 '07 #3
dmjpro
2,476 2GB
yes
country code and country name are shown in the php main program in the text box

but if i try to query after that in the same program taking country code it doesnt fetch any records
Well.

Expand|Select|Wrap|Line Numbers
  1. function stateChanged() {
  2. if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete") && xmlHttp.status==200)
  3.  {
  4.     alert(xmlHttp.responseText);
  5.     /*var ar=xmlHttp.responseText.split("|");
  6.    al=ar.length;
  7.    document.getElementById("c_cde").value=ar[1] ;
  8.       document.getElementById("tbl1").innerHTML=ar[2] ;*/
  9.    }
  10. }
  11.  
Make sure that is the "alert" getting executed.
Then check, is "innerHTML" is the standard attribute of "document.getElementById("tbl1")".
Let me know these things.
And one more important thing, check the query string what you sending.

Kind regards,
Dmjpro.
Oct 3 '07 #4
SSG001
110 100+
when i alerted xmlhttprequest thing
it shows <ul><li>india-001</li></ul>
|001|<tr><td>091</td><td>asia</td></tr><tr><td>092</td><td>europe</td></tr>
Oct 3 '07 #5
dmjpro
2,476 2GB
when i alerted xmlhttprequest thing
it shows <ul><li>india-001</li></ul>
|001|<tr><td>091</td><td>asia</td></tr><tr><td>092</td><td>europe</td></tr>
That's the problem with "responseText".
Do you know XML.?
Try to use with "responseXML".
And on the client side parse it's each Node with "NodeValue" and create dynamically rows and cells :-)

Any further help please post here.

Kind regards,
Dmjpro.
Oct 3 '07 #6
SSG001
110 100+
thanks for the reply

as i alerted xmlhttp... countrycodevalue is passed in the text box but only table is not shown although alerted correctly


i dnt know xml
but i instead of creating rows in server.php using php
i have done following thing
and checked alert with xmlhtt it showing the correctly as u say is it something to do with xml ...since i'm new to xml

in the while loop while loop
Expand|Select|Wrap|Line Numbers
  1.  <script>
  2. var tbl = document.getElementById('tblprice');
  3. var lastRow = tbl.rows.length;
  4.  var iteration = lastRow;
  5.   var row = tbl.insertRow(lastRow);
  6.  var cellLeft = row.insertCell(0);
  7.   var textNode = document.createTextNode('<?=$misdcode?>');
  8.   cellLeft.appendChild(textNode);
  9.  
  10.   var cellLeft = row.insertCell(1);
  11.   var textNode1 = document.createTextNode('<?=$mcontinent?>');
  12.   cellLeft.appendChild(textNode1);
  13.   </script>
Oct 3 '07 #7
dmjpro
2,476 2GB
thanks for the reply

as i alerted xmlhttp... countrycodevalue is passed in the text box but only table is not shown although alerted correctly


i dnt know xml
but i instead of creating rows in server.php using php
i have done following thing
and checked alert with xmlhtt it showing the correctly as u say is it something to do with xml ...since i'm new to xml

in the while loop while loop
Expand|Select|Wrap|Line Numbers
  1.  <script>
  2. var tbl = document.getElementById('tblprice');
  3. var lastRow = tbl.rows.length;
  4.  var iteration = lastRow;
  5.   var row = tbl.insertRow(lastRow);
  6.  var cellLeft = row.insertCell(0);
  7.   var textNode = document.createTextNode('<?=$misdcode?>');
  8.   cellLeft.appendChild(textNode);
  9.  
  10.   var cellLeft = row.insertCell(1);
  11.   var textNode1 = document.createTextNode('<?=$mcontinent?>');
  12.   cellLeft.appendChild(textNode1);
  13.   </script>
Ok!
Then try with this.

Expand|Select|Wrap|Line Numbers
  1. <tbody><tr><td>091</td><td>asia</td></tr><tr><td>092</td><td>europe</td></tr></tbody>
  2.  
Just update your server.php so that "ar[2]" returns that string.
You got me :-)

Kind regards,
Dmjpro.
Oct 3 '07 #8
SSG001
110 100+
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. //out of the while loop
  3. var tbl = document.getElementById('tblcountry');
  4. var tbody = tbl.appendChild(document.createElement('tbody'));
  5. var lastRow = tbl.rows.length;
  6. </script>
is the right way to create tbody and then append to table
then how do i append the rows created to this body?
and when i alert
this in the while loop

Expand|Select|Wrap|Line Numbers
  1.  var iteration = lastRow;
  2.   var row = tbody.insertRow(lastRow);
  3.  var cellLeft = row.insertCell(0);
  4.   var textNode = document.createTextNode('<?=$misdcode?>');
  5.   cellLeft.appendChild(textNode);
  6.  
  7.   var cellLeft = row.insertCell(1);
  8.   var textNode1 = document.createTextNode('<?=$mcontinent?>');
  9.   cellLeft.appendChild(textNode1);
  10.   </script>
and if alert ar[2] then i get soemthing like this

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. //out of the while loop
  3. var tbl = document.getElementById('tblcountry');
  4. var tbody = tbl.appendChild(document.createElement('tbody'));
  5. var lastRow = tbl.rows.length;
  6. </script>
  7.  
  8. <script>
  9.   var row = tbody.insertRow(lastRow);
  10.  var cellLeft = row.insertCell(0);
  11.   var textNode = document.createTextNode('091');
  12.   cellLeft.appendChild(textNode);
  13.  
  14.   var cellLeft = row.insertCell(1);
  15.   var textNode1 = document.createTextNode('asia');
  16.   cellLeft.appendChild(textNode1);
  17.   </script>
  18. <script>
  19.  
  20.   var row = tbody.insertRow(lastRow);
  21.  var cellLeft = row.insertCell(0);
  22.   var textNode = document.createTextNode('092');
  23.   cellLeft.appendChild(textNode);
  24.  
  25.   var cellLeft = row.insertCell(1);
  26.   var textNode1 = document.createTextNode('europe');
  27.   cellLeft.appendChild(textNode1);
  28.   </script>
Oct 3 '07 #9
dmjpro
2,476 2GB
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. //out of the while loop
  3. var tbl = document.getElementById('tblcountry');
  4. var tbody = tbl.appendChild(document.createElement('tbody'));
  5. var lastRow = tbl.rows.length;
  6. </script>
is the right way to create tbody and then append to table
then how do i append the rows created to this body?
and when i alert
this in the while loop

Expand|Select|Wrap|Line Numbers
  1.  var iteration = lastRow;
  2.   var row = tbody.insertRow(lastRow);
  3.  var cellLeft = row.insertCell(0);
  4.   var textNode = document.createTextNode('<?=$misdcode?>');
  5.   cellLeft.appendChild(textNode);
  6.  
  7.   var cellLeft = row.insertCell(1);
  8.   var textNode1 = document.createTextNode('<?=$mcontinent?>');
  9.   cellLeft.appendChild(textNode1);
  10.   </script>
and if alert ar[2] then i get soemthing like this

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. //out of the while loop
  3. var tbl = document.getElementById('tblcountry');
  4. var tbody = tbl.appendChild(document.createElement('tbody'));
  5. var lastRow = tbl.rows.length;
  6. </script>
  7.  
  8. <script>
  9.   var row = tbody.insertRow(lastRow);
  10.  var cellLeft = row.insertCell(0);
  11.   var textNode = document.createTextNode('091');
  12.   cellLeft.appendChild(textNode);
  13.  
  14.   var cellLeft = row.insertCell(1);
  15.   var textNode1 = document.createTextNode('asia');
  16.   cellLeft.appendChild(textNode1);
  17.   </script>
  18. <script>
  19.  
  20.   var row = tbody.insertRow(lastRow);
  21.  var cellLeft = row.insertCell(0);
  22.   var textNode = document.createTextNode('092');
  23.   cellLeft.appendChild(textNode);
  24.  
  25.   var cellLeft = row.insertCell(1);
  26.   var textNode1 = document.createTextNode('europe');
  27.   cellLeft.appendChild(textNode1);
  28.   </script>

You need not to change your JavaScript Code.
Only .php file.

Kind regards,
Dmjpro.
Oct 3 '07 #10
SSG001
110 100+
but this code is from server.php
and not a javascript file
here insetad of using php for rows creation in the loop
i have used javascript and dom
to create rows with values
....

tell me if i'm going wrong anywhere


but i'm still confuesd that after choosing country name and country code is shown in the corresponding text box on the main php form then why can't i use it to query a database there in that program itslef rather then going to server.php
and creating rows
i tried to alert in the main program country code it shows it is empty but then it is hwon int he form .....getting totally confused
Oct 3 '07 #11
dmjpro
2,476 2GB
but this code is from server.php
and not a javascript file
here insetad of using php for rows creation in the loop
i have used javascript and dom
to create rows with values
....

tell me if i'm going wrong anywhere


but i'm still confuesd that after choosing country name and country code is shown in the corresponding text box on the main php form then why can't i use it to query a database there in that program itslef rather then going to server.php
and creating rows
i tried to alert in the main program country code it shows it is empty but then it is hwon int he form .....getting totally confused

I am also getting confused.
Look :-)
Your alert now shows
Expand|Select|Wrap|Line Numbers
  1. <ul><li>india-001</li></ul>
  2. |001|<tr><td>091</td><td>asia</td></tr><tr><td>092</td><td>europe</td></tr>
  3.  
Now change the server.php file in such a way so that your alert shows ....

Expand|Select|Wrap|Line Numbers
  1. <ul><li>india-001</li></ul>
  2. |001|<tbody><tr><td>091</td><td>asia</td></tr><tr><td>092</td><td>europe</td></tr></tbody>
  3.  
Ok!
Got me.
And no need to change your JavaScript.
What you had before keep it unchanged.

Kind regards,
Dmjpro.
Oct 3 '07 #12
SSG001
110 100+
i'm getting this alert i just put body tag
Expand|Select|Wrap|Line Numbers
  1. <ul><li>india-001</li></ul>
  2. |001|<tbody><tr><td>091</td><td>asia</td></tr><tr><td>092</td><td>europe</td></tr></tbody>
  3.  

but still the table is not shown int he main form
Oct 3 '07 #13
SSG001
110 100+
Expand|Select|Wrap|Line Numbers
  1. <form method="get">
  2. <table id="tbl">
  3. <tr>
  4.     <td bordercolor="#669999"> 
  5.         <label><strong><font size="3">Select country</strong></label></td>
  6.       <td colspan="11" bordercolor="#669999"> 
  7.  <input type="text" c_name="c_name" id="c_name" size="40" class="dlight"  autocomplete="off"  onblur="showCode(this.value);">
  8.     <div id="hint"></div>
  9.     <script type="text/javascript"> 
  10.         new Ajax.Autocompleter("c_name","hint","server.php");
  11.     </script>
  12. <input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" > 
  13.     Expand|Select|Wrap|Line Numbers
  •  
  •     
  •  
  • this c_cde is shown when i select country name correctly
  • depending on this valu i want to fetch records from database and display here and after that show one row to take some new entry form the user i tried even alerting $p_cde but shows blank alert thats y i took that sever.php rows creation
  •  
  •  
  •     
  •  
  • <div id="tbl1">existingrecords from table </div> 
  • //new row to take entry from user 
  • <tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode?>"></td>
  • <td><input type="text" name="continent" id="continent" value="<?=$mcontinent?>"></td></tr>
  • </table>
  • </form>
  • Oct 3 '07 #14
    SSG001
    110 100+
    thanks
    hey i dnt know how i missed but the data from tables is shown at the top of my table in one line


    how i inset it as a first row my table below the existing header

    Expand|Select|Wrap|Line Numbers
    1. <form method="get">
    2. <table id="tbl">
    3. <tr>
    4.     <td bordercolor="#669999"> 
    5.         <label><strong><font size="3">Select country</strong></label></td>
    6.       <td colspan="11" bordercolor="#669999"> 
    7.  <input type="text" c_name="c_name" id="c_name" size="40" class="dlight"  autocomplete="off"  onblur="showCode(this.value);">
    8.     <div id="hint"></div>
    9.     <script type="text/javascript"> 
    10.         new Ajax.Autocompleter("c_name","hint","server.php");
    11.     </script>
    12. <input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" > 
    [code=text]this c_cde is shown when i select country name correctly
    depending on this valu i want to fetch records from database and display here and after that show one row to take some new entry form the user i tried even alerting $p_cde but shows blank alert thats y i took that sever.php rows creation
    Oct 3 '07 #15
    dmjpro
    2,476 2GB
    thanks
    hey i dnt know how i missed but the data from tables is shown at the top of my table in one line


    how i inset it as a first row my table below the existing header

    Expand|Select|Wrap|Line Numbers
    1. <form method="get">
    2. <table id="tbl">
    3. <tr>
    4.     <td bordercolor="#669999"> 
    5.         <label><strong><font size="3">Select country</strong></label></td>
    6.       <td colspan="11" bordercolor="#669999"> 
    7.  <input type="text" c_name="c_name" id="c_name" size="40" class="dlight"  autocomplete="off"  onblur="showCode(this.value);">
    8.     <div id="hint"></div>
    9.     <script type="text/javascript"> 
    10.         new Ajax.Autocompleter("c_name","hint","server.php");
    11.     </script>
    12. <input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" > 
    [code=text]this c_cde is shown when i select country name correctly
    depending on this valu i want to fetch records from database and display here and after that show one row to take some new entry form the user i tried even alerting $p_cde but shows blank alert thats y i took that sever.php rows creation

    Oh no ............... !!!!!!!!!!!!
    I thought that your tabl1 is an id of Table.
    But it is your Div.
    oh...........!
    So update .php as <table>...</table>
    Now see the results...

    Kind regards,
    Dmjpro.
    Oct 3 '07 #16
    SSG001
    110 100+
    sorry i didnt get you
    Expand|Select|Wrap|Line Numbers
    1. <form method="get">
    2. <table id="tbl">
    3. <tr>
    4.     <td bordercolor="#669999"> 
    5.         <label><strong><font size="3">Select country</strong></label></td>
    6.       <td colspan="11" bordercolor="#669999"> 
    7.  <input type="text" c_name="c_name" id="c_name" size="40" class="dlight"  autocomplete="off"  onblur="showCode(this.value);">
    8.     <div id="hint"></div>
    9.     <script type="text/javascript"> 
    10.         new Ajax.Autocompleter("c_name","hint","server.php");
    11.     </script>
    12. <input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" >
    13. <div id="tbl1"></div>  //this is where i'm displaying my exsitinnd rows 
    14. <tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode?>"></td>
    15. <td><input type="text" name="continent" id="continent" value="<?=$mcontinent?>"></td></tr>
    16. </table>
    17. </form>
    now wot changes i do to get those rows atthe right place

    thanks
    Oct 3 '07 #17
    dmjpro
    2,476 2GB
    Oh!
    Right now I understood what to do next.
    :-)

    Expand|Select|Wrap|Line Numbers
    1. <div><table><tbody id="tbl1">
    2. <tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode?>"></td>
    3. <td><input type="text" name="continent" id="continent" value="<?=$mcontinent?>"></td></tr>
    4. </tbody></table>
    5. </div>
    6.  
    Have a creafull look at this code what i changed in your main php file.

    And what your first server php was, change it to that.
    I mean your tag starts with <tr>...</tr>
    And change the JavaScript ....
    Expand|Select|Wrap|Line Numbers
    1. document.getEocumentById('tabl1').innerHTML=document.getEocumentById('tabl1').innerHTML+xmlHttp.responseText;
    2.  
    Try this.

    Kind regards,
    Dmjpro.
    Oct 3 '07 #18
    SSG001
    110 100+
    thnks
    i made below changes and thnak you once again it works
    but partially
    not exactly wot i want
    it dispalys the records below the header of my table but it blanks my text box values for country name and country code
    i think something related to this statement
    document.getElementById('tbl1').innerHTML=document .getElementById('tbl1').innerHTML+xmlHttp.response Text;


    it overwites my existing rows from the html table from main program or is it because i'm using one more div =hint which is used for autocomplete
    Oct 3 '07 #19
    dmjpro
    2,476 2GB
    Ok!
    I changed your whole code of server.php.

    Expand|Select|Wrap|Line Numbers
    1. <?php
    2. include("../include/con.php");
    3. $sql = "select c_code,c_name from countrymaster  where c_name like '%" . $_GET['c_name'] . "%'";
    4.     $rs = $DB_site->query($sql);
    5. ?>
    6. <ul>
    7. <? while($data = $DB_site->fetch_array($rs)) { ?>
    8.   <li><? echo stripslashes($data['c_name']."-".$data['c_cde']);
    9.   ?></li>
    10. <? } ?>
    11. </ul> 
    12. <?
    13. if($_GET['c_name']!=""){
    14.     $mc_name=$_GET['c_name'];
    15.     $mc_cde=$_GET['c_cde'];
    16.     echo "|".$mc_cde."|";
    17. }
    18. $sql1="select * from countrydetails where c_cde='".$mc_cde."'";
    19.      $db_query_pricelist=$DB_site->query($sql1);
    20.      while($rs=$DB_site->fetch_array($db_query_rs)){
    21.              $misdcode=$rs[isdcode'];
    22.             $mcontinent=$rs['continent'];
    23.         ?>
    24.                                                <tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode;?>"></td>
    25.                                                         <td><input type="text" name="continent" id="continent" value="<?=$mcontinent;?>"></td>
    26.                                                </tr>
    27.             <?     } ?>
    Now change in JavaScript .......

    Expand|Select|Wrap|Line Numbers
    1. document.getEocumentById('tabl1').innerHTML=docume  nt.getEocumentById('tabl1').innerHTML+ar[2];
    2.  
    Now try this.
    Check the php code becuase i m j2ee man :-)

    Kind regards,
    Dmjpro.
    Oct 3 '07 #20
    SSG001
    110 100+
    Thanks once againi chaged my server.php and also the
    javascipt code

    Expand|Select|Wrap|Line Numbers
    1. document.getElementById('tbl1').innerHTML=document.getElementById('tbl1').innerHTML+ar[2];

    but still it blank my country code and country name so below this stateme nt i have added statement for again assigning country code and country name which are erased by the above statement


    it works in ozilla but gives me runtime error for the above statement of javascript in internet explorer and doesnt display my fetched records from the database
    Oct 4 '07 #21
    dmjpro
    2,476 2GB
    Thanks once againi chaged my server.php and also the
    javascipt code

    Expand|Select|Wrap|Line Numbers
    1. document.getElementById('tbl1').innerHTML=document.getElementById('tbl1').innerHTML+ar[2];

    but still it blank my country code and country name so below this stateme nt i have added statement for again assigning country code and country name which are erased by the above statement


    it works in ozilla but gives me runtime error for the above statement of javascript in internet explorer and doesnt display my fetched records from the database
    Well forgot to say you to change the main.php also.
    Have a llok at this :-)

    Expand|Select|Wrap|Line Numbers
    1. <form method="get">
    2. <table id="tbl">
    3. <tr>
    4.     <td bordercolor="#669999"> 
    5.         <label><strong><font size="3">Select country</strong></label></td>
    6.       <td colspan="11" bordercolor="#669999"> 
    7.  <input type="text" c_name="c_name" id="c_name" size="40" class="dlight"  autocomplete="off"  onblur="showCode(this.value);">
    8.     <div id="hint"></div>
    9.     <script type="text/javascript">    
    10.         new Ajax.Autocompleter("c_name","hint","server.php");
    11.     </script>
    12. <input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" >
    13. <div><table><tbody id = "tbl1">
    14. <tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode?>"></td>
    15. <td><input type="text" name="continent" id="continent" value="<?=$mcontinent?>"></td></tr>
    16. </tbody></table></div>
    17. </form>
    18.  
    Enjoy this code.
    Good Luck.

    Kind regads,
    Dmjpro.
    Oct 4 '07 #22
    SSG001
    110 100+
    thanks
    Expand|Select|Wrap|Line Numbers
    1. <form method="get">
    2. <table id="tbl">
    3. <tr>
    4.     <td bordercolor="#669999"> 
    5.         <label><strong><font size="3">Select country</strong></label></td>
    6.       <td colspan="11" bordercolor="#669999"> 
    7.  <input type="text" c_name="c_name" id="c_name" size="40" class="dlight"  autocomplete="off"  onblur="showCode(this.value);">
    8.     <div id="hint"></div>
    9.     <script type="text/javascript">    
    10.         new Ajax.Autocompleter("c_name","hint","server.php");
    11.     </script>
    12. <input type="text" name="c_code" id="countrycode" size="8" class="dlight" value="<?=$c_code?>" >
    13. <div><tbody id = "tbl1"> //JUST REMOVED <TABLE> FROM HERE 
    14. <tr><td><input type="text" name="isdcode" id="isdcode" value="<?=$misdcode?>"></td>
    15. <td><input type="text" name="continent" id="continent" value="<?=$mcontinent?>"></td></tr>
    16. </tbody></table></div>
    17. </form>
    18.  
    this works on mozilla with following stat document.getElementById("tbl1")+=document.getEleme ntById("tbl1")+ar[2];
    but this statement gives me runtime error with Internet explorer

    this is for my knowledge please excuse if my query sounds absurd
    also one imp thing is that i wanted to know that after selecting from text box the value are shown but when i try to write a query in the main form itself
    where country name and country code are seen i cant query my table depending upon the country code
    my query is not getting the value
    actually earlier i was trying for that i wanted to select from my text box tand then just put the values in country code and country name using server.php and then in the main form itself write a query to get more details from table using countrycode
    Oct 5 '07 #23
    SSG001
    110 100+
    I'm getting runtime error for internet explorer

    for the below code
    Oct 9 '07 #24
    dmjpro
    2,476 2GB
    I'm getting runtime error for internet explorer

    for the below code
    Happy to see that you found your code worked in Mozilla.
    What error you getting in IE?

    Debasis Jana
    Oct 9 '07 #25
    SSG001
    110 100+
    Happy to see that you found your code worked in Mozilla.
    What error you getting in IE?

    Debasis Jana

    Expand|Select|Wrap|Line Numbers
    1.  document.getElementById("tbl1")+=document.getElementById("tbl1")+ar[2];
    but this statement gives me runtime error with Internet explorer

    this is for my knowledge please excuse if my query sounds absurd
    also one imp thing is that i wanted to know that after selecting from text box the value are shown but when i try to write a query in the main form itself
    where country name and country code are seen i cant query my table depending upon the country code
    my query is not getting the value
    actually earlier i was trying for that i wanted to select from my text box tand then just put the values in country code and country name using server.php and then in the main form itself write a query to get more details from table using countrycode
    Oct 15 '07 #26
    dmjpro
    2,476 2GB
    Expand|Select|Wrap|Line Numbers
    1.  document.getElementById("tbl1")+=document.getElementById("tbl1")+ar[2];
    but this statement gives me runtime error with Internet explorer

    this is for my knowledge please excuse if my query sounds absurd
    also one imp thing is that i wanted to know that after selecting from text box the value are shown but when i try to write a query in the main form itself
    where country name and country code are seen i cant query my table depending upon the country code
    my query is not getting the value
    actually earlier i was trying for that i wanted to select from my text box tand then just put the values in country code and country name using server.php and then in the main form itself write a query to get more details from table using countrycode
    It should be ...
    Expand|Select|Wrap|Line Numbers
    1. document.getElementById("tbl1").innerHTML +=document.getElementById("tbl1").innerHTML+ar[2]
    2.  
    Debasis Jana
    Oct 15 '07 #27
    SSG001
    110 100+
    It should be ...
    Expand|Select|Wrap|Line Numbers
    1. document.getElementById("tbl1").innerHTML +=document.getElementById("tbl1").innerHTML+ar[2]
    2.  
    Debasis Jana

    Error: invalid assignment left-hand side

    Expand|Select|Wrap|Line Numbers
    1. document.getElementById("tbl1")+=document.getElementById("tbl1")+ar[2];
    Oct 16 '07 #28
    SSG001
    110 100+
    Error: invalid assignment left-hand side with internet explorer


    Expand|Select|Wrap|Line Numbers
    1. document.getElementById("tbl1")+=document.getElementById("tbl1")+ar[2];
    Oct 17 '07 #29
    SSG001
    110 100+
    Error: invalid assignment left-hand side with internet explorer


    Code: ( javascript )
    document.getElementById("tbl1")+=document.getEleme ntById("tbl1")+ar[2];

    it is because of object is created in some different way in IE or something to do with a my cross browser creation function

    Expand|Select|Wrap|Line Numbers
    1. function GetXmlHttpObject1()
    2. {
    3. var xmlHttp=null;
    4. try
    5.  {
    6.  // Firefox, Opera 8.0+, Safari
    7.      xmlHttp=new XMLHttpRequest();
    8.  }
    9. catch (e)
    10.  {
    11.      //Internet Explorer
    12.      try
    13.       {
    14.           xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    15.       }
    16.      catch (e)
    17.       {
    18.  
    19.           xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    20.       }
    21.  }
    22.     if (!xmlHttp && typeof XMLHttpRequest!='undefined') { 
    23.     xmlHttp = new XMLHttpRequest(); 
    24.     }
    25. return xmlHttp;
    26. }
    Oct 18 '07 #30
    acoder
    16,027 Expert Mod 8TB
    Please use code tags when posting code like this:
    [CODE=javascript]
    Your JavaScript code goes here...
    [/code]
    Oct 18 '07 #31

    Sign in to post your reply or Sign up for a free account.

    Similar topics

    9
    by: Gary | last post by:
    Hello, Is it possible to dynamically update a textbox with words chosen from a list using form checkboxes and javascript? Gary
    1
    by: Rob | last post by:
    I have a date text box (input type = text) in an ASP.NET/Javascript environment. I wanted to force the users to enter dates in a "__/__/____", "dd/mm/yyyy" or similar format. The textbox needs to...
    2
    by: | last post by:
    Hi everyone, I have a form with a combo box on it. When you select a value (a PO#) from the combo box, the bound field is the indexID of the selected PO. On the same form, I have a text box...
    0
    southoz
    by: southoz | last post by:
    Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
    14
    by: ZaphodBBB | last post by:
    Hi O.S. = Windows XP Pro all Service Packs Access = 2003 I have a form with 2 tabbed pages. On the second page I have a subform which populates in Datasheet view with a list of items. One...
    2
    by: Mark Roughton | last post by:
    I have a form where the users need to view records for various criteria, one of which is a date field on which they may wish to view all related data for the selected date, for all dates upto and...
    5
    by: Mukesh | last post by:
    Hi i want to use AJAX.net in my Existing Application I have already installed the ajax .net ..net 3.0 and using VS 2005 in the old application i have added a new web form then script manager...
    1
    by: tomlebold | last post by:
    Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on...
    1
    by: sudip2008 | last post by:
    When using the Calendar Popup in a content page of a masterpage the strForName is always set to aspnetForm This breaks this line from working properly window.opener.document.forms...... How can...
    0
    by: ryjfgjl | last post by:
    ExcelToDatabase: batch import excel into database automatically...
    0
    by: jfyes | last post by:
    As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
    0
    by: ArrayDB | last post by:
    The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
    1
    by: PapaRatzi | last post by:
    Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
    1
    by: Defcon1945 | last post by:
    I'm trying to learn Python using Pycharm but import shutil doesn't work
    1
    by: Shællîpôpï 09 | last post by:
    If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
    0
    by: af34tf | last post by:
    Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
    0
    by: Faith0G | last post by:
    I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
    0
    isladogs
    by: isladogs | last post by:
    The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

    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.