Added "Preview" button for survey builders

This commit is contained in:
Patrick Donelan 2009-01-09 07:13:15 +00:00
parent 8a4f26215a
commit 63e74f14f4
3 changed files with 62 additions and 5 deletions

View file

@ -133,7 +133,7 @@ Survey.OnLoad = function() {
initHandler: function(){
new YAHOO.util.DDTarget("sections","sections");
Survey.Comm.loadSurvey();
},
}
}
}();

View file

@ -21,8 +21,14 @@ Survey.ObjectTemplate = new function(){
{ text:"Cancel", handler:function(){this.cancel();}},
{ text:"Delete", handler:function(){document.getElementById('delete').value = 1; this.submit();}}
];
if (type !== 'answer') {
butts.push({
text: "Preview",
handler: jumpTo
});
}
var form = new YAHOO.widget.Dialog(type,
var dialog = new YAHOO.widget.Dialog(type,
{
width : "600px",
context: [document.body, 'tr', 'tr'],
@ -31,8 +37,11 @@ Survey.ObjectTemplate = new function(){
buttons : butts
} );
form.callback = Survey.Comm.callback;
form.render();
dialog.callback = Survey.Comm.callback;
dialog.render();
function jumpTo() {
window.location.search = 'func=jumpTo;id=' + dialog.form.id.value;
}
var textareaId = type+'Text';
var textarea = YAHOO.util.Dom.get(textareaId);
@ -52,7 +61,7 @@ Survey.ObjectTemplate = new function(){
}
myTextarea.render();
form.show();
dialog.show();
}
}();