// JavaScript Document /* FORM VALIDATION FUNCTION */ function formValidate(frm){ if(frm.bodytype_title.value=='') { alert("Please Enter Body Type Name"); frm.bodytype_title.focus(); return false; } else return true; } /* AJAX CALLING FUNCTION FOR POPULATING EDIT */ function editBody(id) { if (window.XMLHttpRequest) http_request = new XMLHttpRequest(); else if (window.ActiveXObject) http_request = new ActiveXObject("Microsoft.XMLHTTP"); url ='http://www.reliancemotors.com.na/secure/actions/bodytype.action.php?action=edit&id='+id; // window.open(url); try { http_request.open('GET', url,true); } catch(err){alert(err.toString());} http_request.onreadystatechange = handleResponseVehType; try { http_request.send(null); } catch(err){alert(err.toString());} } function handleResponseVehType() { var xmldoc = http_request.responseXML; if(http_request.readyState == 4 ) { if(xmldoc.getElementsByTagName('bodytype_title')[0].hasChildNodes()) document.getElementById("bodytype_title").value = xmldoc.getElementsByTagName('bodytype_title')[0].firstChild.data; if(xmldoc.getElementsByTagName('bodytype_id')[0].hasChildNodes()) document.getElementById("bodytype_id").value = xmldoc.getElementsByTagName('bodytype_id')[0].firstChild.data; document.getElementById("action").value = "update"; document.getElementById("button").value = "Update BodyType"; } }