husin Posted July 23, 2009 Share Posted July 23, 2009 hey again people, this site is awesome! anyways, i have this code and everything is working except one thing. if you pay attention to the function displayNamesL(), i am trying to make it so that what ever letter you type in the textbox, it will search that when i click the "search" button. the button before that works perfectly. i am getting this error code: line 16, char 5, document.frmSearch.txtLetter.value; is null or not an object, code 0. i made a comment for line 16 so u don't have to go searchn for it. so if you guys can figure this, much appreciated ! <html> <head> <title>AJAX Simple Demo</title> <script type="text/javascript"> function displayNames() { var myHTTP = new XMLHttpRequest(); myHTTP.open("GET", "display.php?search=r", false); myHTTP.send(null); var response = myHTTP.responseText; document.getElementById("display_table").innerHTML = myHTTP.responseText; } function displayNamesL() { var letter = "search=" + line //line16//document.frmSearch.txtLetter.value; var myHTTP = new XMLHttpRequest(); myHTTP.open("GET", "display.php?letter", false); myHTTP.send(null); var response = myHTTP.responseText; document.getElementById("display_table").innerHTML = myHTTP.responseText; } </script> </head> <body> <form name="frmSearch" method="get" action=""> <p><label>Click to see which names start with "R".</label></p></br> <p><input type="button" value="Names - 'R'" onclick="displayNames()" /></p></br> <p><label>Or type in a letter of your choice.</label></p></br> <p><input type="button" value="Search" onclick="displayNamesL()" /></p></br> <p><input type="text" value="" name="Letter" /></p> </p> <span id="display_table"> </span> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/167059-solved-search-wont-work-with-txtbox/ Share on other sites More sharing options...
dzelenika Posted July 23, 2009 Share Posted July 23, 2009 i don't seee txtLetter in your HTML Link to comment https://forums.phpfreaks.com/topic/167059-solved-search-wont-work-with-txtbox/#findComment-880892 Share on other sites More sharing options...
husin Posted July 23, 2009 Author Share Posted July 23, 2009 loooool!!!! o my gosh man! ya that solved the problem! lol, i noticed that before, but i thought you didn't need it, except in the javascript part, makes no sense now to think of it ...thanks man! Link to comment https://forums.phpfreaks.com/topic/167059-solved-search-wont-work-with-txtbox/#findComment-880897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.