Forum Moderators: open
if(value=='valid'){
alert('Poll submitted successfully');
}
else{
alert('Poll already submitted');
}
refreshSection('2');
} else {
alert("Problem with server response:\n " + req.statusText);
}
}
parent.frames[2].name="main";
}
I have called the above function on :
req.onreadystatechange = processPoll;
This is a validation done for Submitting a poll after selecting the option. It works perfectly as per my requirement. The only problem is even if I click on the 'submit poll' button without choosing any option it will show "Poll Submitted Successfully" but with no change in the graph or values. So, my requirement is a condition which gives an alert as to "Please make a Selection" when clicked on "Submit Poll" button.
The graph/values are read from XML and on submit, the values are written into XML
My brains are shut off at present and i hope someone will be able to help. Thanks in advance.
/*
** retrievePoll() validation is in Ajax
*/
function retrievePoll(url,nameOfFormToPost) {
//get the (form based) params to push up as part of the get request
try {
/*****
At the time of inserting the same poll option Cache object does'nt refresh,
so Math.random() function is used
****/
url=url+getPollFormAsString(nameOfFormToPost)+'&xde='+Math.random();
} catch (e) {
alert('bean problem');
}
//Do the Ajax call
if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest();
req.onreadystatechange = processPoll;
try {
req.open("GET", url, true); //was get
} catch (e) {
alert("Problem Communicating with Server\n"+e);
}
req.send(null);
} else if (window.ActiveXObject) { // IE
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processPoll;
req.open("GET", url, true);
req.send();
}
}
}
and then the above function of processPoll() is called !
Something is missing in processPoll() function. I just cant think of it ...........................