IE problems apparently resolved, and slider and multi-slider allocate accuracy made bullet-proof.
This commit is contained in:
parent
d6cfcd4381
commit
e3bef2b5d7
2 changed files with 39 additions and 12 deletions
|
|
@ -253,15 +253,16 @@ Survey.Form = new function() {
|
||||||
for(var i in q.answers){
|
for(var i in q.answers){
|
||||||
var a = q.answers[i];
|
var a = q.answers[i];
|
||||||
var step = q.answers[i].step;
|
var step = q.answers[i].step;
|
||||||
var scale = sliderWidth/q.answers[i].max;
|
var min = parseInt(q.answers[i].min);
|
||||||
var Event = YAHOO.util.Event;
|
var distance = parseInt(q.answers[i].max) + (-1 * min);
|
||||||
|
var scale = sliderWidth/distance;
|
||||||
var lang = YAHOO.lang;
|
var lang = YAHOO.lang;
|
||||||
var id = a.Survey_answerId;
|
var id = a.Survey_answerId;
|
||||||
var s = YAHOO.widget.Slider.getHorizSlider(id+'slider-bg', id+'slider-thumb',
|
var s = YAHOO.widget.Slider.getHorizSlider(id+'slider-bg', id+'slider-thumb',
|
||||||
0, sliderWidth, (scale*step));
|
0, sliderWidth, (scale*step));
|
||||||
|
|
||||||
s.scale = scale;
|
s.scale = scale;
|
||||||
sliders[id] = s;
|
sliders[id] = s;
|
||||||
s.max = a.max*scale;
|
|
||||||
s.input = a.Survey_answerId;
|
s.input = a.Survey_answerId;
|
||||||
s.scale = scale;
|
s.scale = scale;
|
||||||
document.getElementById(id).value = a.min;
|
document.getElementById(id).value = a.min;
|
||||||
|
|
@ -270,7 +271,7 @@ Survey.Form = new function() {
|
||||||
t.value = this.getRealValue();
|
t.value = this.getRealValue();
|
||||||
};
|
};
|
||||||
s.getRealValue = function() {
|
s.getRealValue = function() {
|
||||||
return this.getValue() / this.scale;
|
return parseInt(( (this.getValue() / total) * distance) + min );
|
||||||
}
|
}
|
||||||
s.subscribe("slideEnd", check);
|
s.subscribe("slideEnd", check);
|
||||||
}
|
}
|
||||||
|
|
@ -279,8 +280,9 @@ Survey.Form = new function() {
|
||||||
this.sliderManager = function(q,t){
|
this.sliderManager = function(q,t){
|
||||||
var total = sliderWidth;
|
var total = sliderWidth;
|
||||||
var step = q.answers[0].step;
|
var step = q.answers[0].step;
|
||||||
var scale = sliderWidth/q.answers[0].max;
|
var min = parseInt(q.answers[0].min);
|
||||||
|
var distance = parseInt(q.answers[0].max) + (-1 * min);
|
||||||
|
var scale = sliderWidth/distance;
|
||||||
for(var i in q.answers){
|
for(var i in q.answers){
|
||||||
var a = q.answers[i];
|
var a = q.answers[i];
|
||||||
var Event = YAHOO.util.Event;
|
var Event = YAHOO.util.Event;
|
||||||
|
|
@ -324,8 +326,8 @@ Survey.Form = new function() {
|
||||||
Event.on(document.getElementById(s.input), "blur", manualEntry);
|
Event.on(document.getElementById(s.input), "blur", manualEntry);
|
||||||
|
|
||||||
s.getRealValue = function() {
|
s.getRealValue = function() {
|
||||||
|
return parseInt(( (this.getValue() / total) * distance) + min );
|
||||||
return Math.round(parseInt(this.getValue()) / scale);
|
//return Math.round(parseInt(this.getValue()) / scale);
|
||||||
}
|
}
|
||||||
document.getElementById(s.input).value = s.getRealValue();
|
document.getElementById(s.input).value = s.getRealValue();
|
||||||
}
|
}
|
||||||
|
|
@ -376,20 +378,28 @@ Survey.Form = new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(b.className == 'mcbutton'){
|
else if(b.className == 'mcbutton'){
|
||||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
var bscount = 0;//button selected count
|
||||||
|
for(var i in butts){
|
||||||
|
if(butts[i].className == 'mcbutton-selected'){bscount++;}
|
||||||
|
}
|
||||||
|
var max = maxA - bscount;//= parseInt(document.getElementById(qid+'max').innerHTML);
|
||||||
if(max == 0){
|
if(max == 0){
|
||||||
b.className='mcbutton';
|
b.className='mcbutton';
|
||||||
//warn that options used up
|
//warn that options used up
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
b.className='mcbutton-selected';
|
b.className='mcbutton-selected';
|
||||||
document.getElementById(qid+'max').innerHTML = parseInt(max-1);
|
//document.getElementById(qid+'max').innerHTML = parseInt(max-1);
|
||||||
document.getElementById(b.hid).value = 1;
|
document.getElementById(b.hid).value = 1;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
b.className='mcbutton';
|
b.className='mcbutton';
|
||||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
var bscount = 0;//button selected count
|
||||||
document.getElementById(qid+'max').innerHTML = parseInt(max+1);
|
for(var i in butts){
|
||||||
|
if(butts[i].className == 'mcbutton-selected'){bscount++;}
|
||||||
|
}
|
||||||
|
var max = maxA - bscount;//= parseInt(document.getElementById(qid+'max').innerHTML);
|
||||||
|
// document.getElementById(qid+'max').innerHTML = parseInt(max+1);
|
||||||
document.getElementById(b.hid).value = '';
|
document.getElementById(b.hid).value = '';
|
||||||
}
|
}
|
||||||
if(qsize == 1){
|
if(qsize == 1){
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,20 @@
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background-image: url(http://casr.ou.edu/root/import/survey/spacer.gif);
|
||||||
|
background-repeat: repeat-y;
|
||||||
|
background-position: 0px 0px;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
width: 80%;
|
||||||
|
height: 40px;
|
||||||
|
margin-left: 80px;
|
||||||
|
}
|
||||||
|
#survey {
|
||||||
|
margin-left: 80px;
|
||||||
|
width: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
div.dateanswer {
|
div.dateanswer {
|
||||||
min-height: 250px;
|
min-height: 250px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue