RSS Forums RSS

Problem with Radio Button error "[object HTMLInputElement]"

Thread Solved
Reply
Posts: 35
Reputation: lonestar23 is an unknown quantity at this point 
Solved Threads: 0
lonestar23 lonestar23 is offline Offline
Light Poster

Problem with Radio Button error "[object HTMLInputElement]"

  #1  
Sep 5th, 2008
Hello,

I am having problems retrieving correct values from two radio buttons in my AJAX script below.

The radio button values are either a 1 or 0 and always produces 0 regardless of which button is selected.

Once in AJAX, I can not have the script retreive a 1 or 0. AJAX script produces "[object HTMLInputElement]" as the response. Not sure what is going wrong.

Thanks in Advance.
Diego

<script type="text/javascript">
var settings = getXmlHttpRequestObject(); function saveCar() { 
if (settings.readyState == 4 || settings.readyState == 0) { 

var car = escape(document.getElementById('car').value);

/* PROBLEM - Radio Button Processor */
var proc17 = document.getElementById("search17");
for (var i = 0; i < proc17.length; i++)
{
    if (proc17[i].checked){
       search17 = proc17[i].value;
       break;
    }
}


settings.open("GET", 'abc.php?proc17=' + proc17 + '&car=' +car, true); 
settings.onreadystatechange = handleSettings; settings.send(null);}}
function handleSettings() { if (settings.readyState == 4) { 

		}
	}
</script>
AddThis Social Bookmark Button
Reply With Quote  
Posts: 184
Reputation: Atli is an unknown quantity at this point 
Solved Threads: 19
Atli's Avatar
Atli Atli is offline Offline
Junior Poster

Re: Problem with Radio Button error "[object HTMLInputElement]"

  #2  
Sep 5th, 2008
Aren't you using the wrong variable in your AJAX URL string?

You assign the "search17" element to the "proc17" variable and then use that in your URL.
Shouldn't the "search17" variable be in the URL?
Reply With Quote  
Posts: 35
Reputation: lonestar23 is an unknown quantity at this point 
Solved Threads: 0
lonestar23 lonestar23 is offline Offline
Light Poster

Re: Problem with Radio Button error "[object HTMLInputElement]"

  #3  
Sep 10th, 2008
The code that ended up working for me is below. I have included only the ajax javascript Thanks to all for your help!

var settings = getXmlHttpRequestObject(); function savePreview() { 
if (settings.readyState == 4 || settings.readyState == 0) { 

 var car = escape(document.getElementById('car').value);

for (index=0; index < document.gMoney.searchMe.length; index++) {
				if (document.gMoney.searchMe[index].checked) {
					var radioValue = document.gMoney.searchMe[index].value;
					break;
				}
			}
	

settings.open("GET", 'abc.php?searchMe=' + radioValue + '&car=' +car, true); 
settings.onreadystatechange = handleSettings; settings.send(null);}}
function handleSettings() { if (settings.readyState == 4) { 
		}
	}
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the PHP Forum
Views: 1371 | Replies: 2 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 11:01 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC