Form variable initialized in form method, but later empty

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

Form variable initialized in form method, but later empty

Postby deezzub » Fri Apr 25, 2014 4:33 pm

I have a form variable attachments initialized, which is filled with values in dc_newCustomToolbar. Later I want to access the object in another method, but then it is empty. I also tried an array atta.

Code: Select all
var attachments = { };
var atta = [ ];

function dc_newCustomToolbar( event, triggerForm, toolbarForm, createRecordOnTop ) {
   
   var attachment;
   
   attachment = plugins.file.showFileSaveDialog( );

   _super.dc_newCustomToolbar( event, triggerForm, toolbarForm, createRecordOnTop );

   if ( attachment ) {
      attachments[ id_nr ] = attachment;
      atta.push( [ id_nr, attachment ] );
      
      application.output( attachments[ id_nr ].getName( ) );
   }
}

function importAttachment( event, documentId ) {
      
   if ( attachments ) {
      for ( var idNo in attachments ) {
         if ( attachments.hasOwnProperty( idNo ) ) {

            application.output( idNo + ' ' + attachments[ idNo ] )
               
         }
      }

   }
}


If I call dc_newCustomToolbar again, then all before added content is available in the attachments object.

What I'm missing?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 13 guests