| | |
Problem with Radio Button error "[object HTMLInputElement]"
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: Mar 2008
Posts: 36
Reputation:
Solved Threads: 0
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
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
PHP Syntax (Toggle Plain Text)
<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>
•
•
Join Date: Mar 2008
Posts: 36
Reputation:
Solved Threads: 0
The code that ended up working for me is below. I have included only the ajax javascript Thanks to all for your help!
PHP Syntax (Toggle Plain Text)
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) { } }
![]() |
Other Threads in the PHP Forum
- Previous Thread: Errors after installing WAMP Server 2
- Next Thread: convert PHP to javascript?
| Thread Tools | Search this Thread |
action address advanced ajax apache api array auto autoincrement basics beginner broken cakephp class cms code codingproblem combobox cron curl database date datepart display domain dynamic email error errorlog file folder form format forms function functions google head href htaccess html image include includingmysecondfileinthechain interactive ip javascript job joomla js limit link load login malfunctioning masterthesis menu multiple mysql nodes oop outofmemmory paging password paypal pdf php popup problem procedure query ram random reference script search server sessions smarty source space sql stored syntax system table traffic tutorial unicode unset up-to-date upload url validation variable video web webapplications websitecontactform youtube





