Survey 2.0 - "Cancel" button not working as expected (#9217)

added call to 'loadSurvey' after 'cancel'
also added code in 'loadSurvey' to allow for a refresh without
displaying an edit window.
This commit is contained in:
David Delikat 2008-12-19 16:11:03 +00:00
parent eeef2fb330
commit d0b8dd17bc
3 changed files with 11 additions and 3 deletions

View file

@ -25,6 +25,7 @@
- fixed #4196: update button doesn't work in IE - fixed #4196: update button doesn't work in IE
7.6.6 7.6.6
- fixed #9217: Survey 2.0 - "Cancel" button not working as expected(David Delikat)
- fixed #8792: Image Preview gives ERROR in Collateral Manager - fixed #8792: Image Preview gives ERROR in Collateral Manager
- fixed #8774: Forum Rich Edit no longer supports indent/outdent - fixed #8774: Forum Rich Edit no longer supports indent/outdent
- fixed #4173: fieldnames in profilefields can contain spaces - fixed #4173: fieldnames in profilefields can contain spaces

View file

@ -429,13 +429,19 @@ sub www_dragDrop {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_loadSurvey { sub www_loadSurvey {
my ( $self, $options ) = @_; my ( $self, $options ) = @_;
my $editflag = 1;
$self->loadSurveyJSON(); $self->loadSurveyJSON();
my $address = defined $options->{address} ? $options->{address} : undef; my $address = defined $options->{address} ? $options->{address} : undef;
if ( !defined $address ) { if ( !defined $address ) {
if ( my $inAddress = $self->session->form->process("data") ) { if ( my $inAddress = $self->session->form->process("data") ) {
$address = [ split /-/, $inAddress ]; if( $inAddress eq '-' ) {
$editflag = 0;
$address = [ 0 ];
} else {
$address = [ split /-/, $inAddress ];
}
} }
else { else {
$address = [0]; $address = [0];
@ -509,7 +515,8 @@ sub www_loadSurvey {
#ids is a list of all ids passed in which are draggable (for adding events) #ids is a list of all ids passed in which are draggable (for adding events)
#type is the object type #type is the object type
my $return = { my $return = {
"address", $address, "buttons", \%buttons, "edithtml", $editHtml, "address", $address, "buttons", \%buttons,
"edithtml", $editflag ? $editHtml : '',
"ddhtml", $html, "ids", \@ids, "type", $var->{type} "ddhtml", $html, "ids", \@ids, "type", $var->{type}
}; };
$self->session->http->setMimeType('application/json'); $self->session->http->setMimeType('application/json');

View file

@ -11,7 +11,7 @@ Survey.ObjectTemplate = new function(){
var butts = [ var butts = [
{ text:"Submit", handler:function(){this.submit();}, isDefault:true }, { text:"Submit", handler:function(){this.submit();}, isDefault:true },
{ text:"Copy", handler:function(){document.getElementById('copy').value = 1; this.submit();}}, { text:"Copy", handler:function(){document.getElementById('copy').value = 1; this.submit();}},
{ text:"Cancel", handler:function(){this.cancel();}}, { text:"Cancel", handler:function(){this.cancel(); Survey.Comm.loadSurvey('-');}},
{ text:"Delete", handler:function(){document.getElementById('delete').value = 1; this.submit();}} { text:"Delete", handler:function(){document.getElementById('delete').value = 1; this.submit();}}
]; ];