Summaries added to the survey

This commit is contained in:
Kaleb Murphy 2009-04-05 19:33:46 +00:00
parent e918f3ff7b
commit a6a70a46e0
7 changed files with 81 additions and 16 deletions

View file

@ -327,6 +327,11 @@ if (typeof Survey === "undefined") {
// Public API
Survey.Form = {
showSummary: function(html){
var html = html;
document.getElementById('survey').innerHTML = html;
YAHOO.util.Event.addListener("submitbutton", "click", function(){ Survey.Comm.submitSummary(); });
},
displayQuestions: function(params){
toValidate = [];
var qs = params.questions;

View file

@ -44,14 +44,23 @@ if (typeof Survey === "undefined") {
if (response.type === 'displayquestions') {
Survey.Form.displayQuestions(response);
}
else
else{
if (response.type === 'forward') {
//YAHOO.log("going to "+response.url);
location.href = response.url;
var url;
if(response.url.match(/http/)){
url = response.url;
}else{
url = location.protocol+"//"+location.host+"/"+response.url;
}
window.location = url;
}
else if(response.type === 'summary'){
Survey.Form.showSummary(response.summary);
}
else {
alert("bad response");
}
}
},
failure: function(o){
callMade = 0;
@ -63,6 +72,10 @@ if (typeof Survey === "undefined") {
}
}
},
submitSummary: function(data,functionName){
var sUrl = "?func=loadQuestions&shownSummary=1";
request(sUrl, this.callback, null, null, null);
},
callServer: function(data, functionName, form, hasFile){
var postData;
if (!form) {