// JavaScript Document function formValidate(frm){ if(frm.maker_id.value=='') { alert("Please Select Make") frm.maker_id.focus(); return false; } else if(frm.model_title.value=='') { alert("Please Enter model Name"); frm.model_title.focus(); return false; } else return true; } /* AJAX CALLING FUNCTION FOR POPULATING EDIT */ function editVehModel(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/model.action.php?action=edit&id='+id; // window.open(url); try { http_request.open('GET', url,true); } catch(err){alert(err.toString());} http_request.onreadystatechange = handleResponseVehmodel; try { http_request.send(null); } catch(err){alert(err.toString());} } function handleResponseVehmodel() { var xmldoc = http_request.responseXML; if(http_request.readyState == 4 ) { if(xmldoc.getElementsByTagName('make_id')[0].hasChildNodes()) document.getElementById("maker_id").value = xmldoc.getElementsByTagName('make_id')[0].firstChild.data; if(xmldoc.getElementsByTagName('model_title')[0].hasChildNodes()) document.getElementById("model_title").value = xmldoc.getElementsByTagName('model_title')[0].firstChild.data; if(xmldoc.getElementsByTagName('model_id')[0].hasChildNodes()) document.getElementById("model_id").value = xmldoc.getElementsByTagName('model_id')[0].firstChild.data; document.getElementById("action").value = "update"; document.getElementById("button").value = "Update Model"; } }