Last checkin before major changes to buttons
This commit is contained in:
parent
93bbf128ca
commit
bb891242a4
4 changed files with 32 additions and 11 deletions
|
|
@ -105,12 +105,12 @@ YAHOO.util.Event.addListener("testB", "click", function(){Survey.Comm.callServer
|
||||||
container: a.Survey_answerId+"container", checked: false });
|
container: a.Survey_answerId+"container", checked: false });
|
||||||
b.label=a.recordedAnswer;
|
b.label=a.recordedAnswer;
|
||||||
}else{
|
}else{
|
||||||
|
// b = new YAHOO.widget.Button({ type: "checkbox", id: a.Survey_answerId+'button', name: a.Survey_answerId+'button',
|
||||||
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.Survey_answerId+'button', name: a.Survey_answerId+'button',
|
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.Survey_answerId+'button', name: a.Survey_answerId+'button',
|
||||||
value: a.Survey_answerId,
|
value: a.Survey_answerId,
|
||||||
container: a.Survey_answerId+"container", checked: false });
|
container: a.Survey_answerId+"container", checked: false });
|
||||||
b.label=a.answerText;
|
|
||||||
}
|
}
|
||||||
b.setStyle('text-align','center');
|
//b.set('label',a.answerText);
|
||||||
b.on("click", this.buttonChanged,[b,a.Survey_questionId,q.maxAnswers,butts,qs.length,a.Survey_answerId]);
|
b.on("click", this.buttonChanged,[b,a.Survey_questionId,q.maxAnswers,butts,qs.length,a.Survey_answerId]);
|
||||||
if(a.verbatim == 1){
|
if(a.verbatim == 1){
|
||||||
verb = 1;
|
verb = 1;
|
||||||
|
|
@ -342,11 +342,16 @@ YAHOO.util.Event.addListener("testB", "click", function(){Survey.Comm.callServer
|
||||||
max = parseInt(max);
|
max = parseInt(max);
|
||||||
if(maxA == 1){
|
if(maxA == 1){
|
||||||
for(var i in butts){
|
for(var i in butts){
|
||||||
butts[i].set('checked',false);
|
if(butts[i] != b){
|
||||||
document.getElementById(butts[i].hid).value = '';
|
butts[i].set('checked',false);
|
||||||
|
document.getElementById(butts[i].hid).value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(b.get('checked') == true){
|
||||||
|
document.getElementById(b.hid).value = 1;
|
||||||
|
}else{
|
||||||
|
document.getElementById(b.hid).value = '';
|
||||||
}
|
}
|
||||||
b.set('checked',true);
|
|
||||||
document.getElementById(b.hid).value = 1;
|
|
||||||
}
|
}
|
||||||
else if(b.get('checked')){
|
else if(b.get('checked')){
|
||||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Survey.Comm= new function(){
|
||||||
|
|
||||||
this.url = '';
|
this.url = '';
|
||||||
this.setUrl = function(u){this.url = u;}
|
this.setUrl = function(u){this.url = u;}
|
||||||
|
var callMade = 0;
|
||||||
var request = function(sUrl,callback,postData,form, hasFile){
|
var request = function(sUrl,callback,postData,form, hasFile){
|
||||||
if(form != undefined){
|
if(form != undefined){
|
||||||
if(hasFile){
|
if(hasFile){
|
||||||
|
|
@ -19,15 +19,22 @@ Survey.Comm= new function(){
|
||||||
}
|
}
|
||||||
//console.log('setForm was true');
|
//console.log('setForm was true');
|
||||||
}
|
}
|
||||||
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
if(callMade == 1){
|
||||||
|
alert("Waiting on previous request");
|
||||||
|
}else{
|
||||||
|
callMade = 1;
|
||||||
|
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.callback = {
|
this.callback = {
|
||||||
upload:function(o){
|
upload:function(o){
|
||||||
|
callMade = 0;
|
||||||
Survey.Comm.callServer('','loadQuestions');
|
Survey.Comm.callServer('','loadQuestions');
|
||||||
},
|
},
|
||||||
success:function(o){
|
success:function(o){
|
||||||
|
callMade = 0;
|
||||||
var response = '';
|
var response = '';
|
||||||
response = YAHOO.lang.JSON.parse(o.responseText);
|
response = YAHOO.lang.JSON.parse(o.responseText);
|
||||||
if(response.type == 'displayquestions'){
|
if(response.type == 'displayquestions'){
|
||||||
|
|
@ -40,6 +47,7 @@ Survey.Comm= new function(){
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
failure: function(o){
|
failure: function(o){
|
||||||
|
callMade = 0;
|
||||||
if(o.status == -1){
|
if(o.status == -1){
|
||||||
alert("Last request timed out, please try again");
|
alert("Last request timed out, please try again");
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,27 @@ if (typeof Survey == "undefined") {
|
||||||
}
|
}
|
||||||
|
|
||||||
Survey.Comm = new function(){
|
Survey.Comm = new function(){
|
||||||
|
var callMade = 0;
|
||||||
|
|
||||||
var request = function(sUrl,callback,postData){
|
var request = function(sUrl,callback,postData){
|
||||||
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
if(callMade == 1){
|
||||||
|
alert("Waiting on previous call");
|
||||||
|
}else{
|
||||||
|
callMade = 1;
|
||||||
|
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.callback = {
|
this.callback = {
|
||||||
success:function(o){
|
success:function(o){
|
||||||
|
callMade = 0;
|
||||||
Survey.Data.loadData(YAHOO.lang.JSON.parse(o.responseText));
|
Survey.Data.loadData(YAHOO.lang.JSON.parse(o.responseText));
|
||||||
},
|
},
|
||||||
failure: function(o){
|
failure: function(o){
|
||||||
|
callMade = 0;
|
||||||
alert("Last request failed");
|
alert("Last request failed");
|
||||||
Survey.Data.loadLast();
|
Survey.Data.loadLast();
|
||||||
},
|
},
|
||||||
timeout: 1000
|
timeout: 5000
|
||||||
};
|
};
|
||||||
this.loadSurvey = function(p){
|
this.loadSurvey = function(p){
|
||||||
var postData = "data="+p;
|
var postData = "data="+p;
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,5 @@ div.slider-max-thumb {
|
||||||
}
|
}
|
||||||
.yui-button button{
|
.yui-button button{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
min-width: 50px;
|
min-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue