EDITED
I have a form (I'm using someone else's code base, and can't find the actual name of the form itself, which is making this harder), and right now I have 2 fields that are needed in a JavaScript call.
I have an input box (which has the JavaScript call 'getTotal' and is sending the value with onkeydown (this.value)) and I have a radio button selection. I need to know how to send the button value along with the input value to the JavaScript function.
If I try to find the value within the 'getTotal' function using:
var taxes = document.getElementById('add-event-dialog-taxes').checked.val();
I get the error "Cannot convert 'document.getElementById('add-event-dialog-taxes')' to object".
If I use:
var taxes = $("input[name='add-event-dialog-taxes']:checked").val();
I get no errors but the value isn't being passed to the AJAX page.
If exclude trying to find the button value, the function works properly.
Here are the fields:
<input type="text" id="add-event-dialog-subtotal" style="width:100px" placeholder="0.00" onkeydown="getTotal(this.value)"><input type='radio' name='add-event-dialog-taxes'  value='gstpst' checked/> GST + PST</br>
<input type='radio' name='add-event-dialog-taxes' value='gst'/> GST Only</br>
<input type='radio' name='add-event-dialog-taxes' value='pst' /> PST Only </br>
<input type='radio' name='add-event-dialog-taxes' value='none'/> No Taxes`
Here is the function:
function getTotal(value) {  
    //var taxes = document.getElementById('add-event-dialog-taxes').checked.val();
    //var taxes = $("input[name='add-event-dialog-taxes']:checked").val();
    var strURL="display/getTotal.php?value="+value+"&taxes="+taxes;
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
                // only if "OK"
                if (req.status == 200) {                        
                    document.getElementById('getTotal').innerHTML=req.responseText;                 
                } else {
                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                }
            }               
        }           
        req.open("GET", strURL, true);
        req.send(null);
    }       
}
And could someone please help me mark up this post? I can never seem to get the code blocks to format correctly. =(
 
     
     
    