Messagebox in webclient

Hello Everybody

I use this code for a messagebox, which should work in Smart- and Webclient
(original code from someone in this forum)

function g_dialog_box() 
{
//parameter titel,message,buttons,width,hight,formname
	//******************************************************************************
	//Überschrift
   var vTitle = arguments[0];

    //meldung
   var vMessage = arguments[1];

   // buttons in array
   var vButtons = arguments[2];
   
   //breite
   var vWidth = arguments[3];	
  if(!vWidth){
      vWidth = 200; // 300 ist default
   }

   //höhe
   var vHeight = arguments[4];
   if(!vHeight){
      vHeight = 80; // 80 ist default
   }
   
   //formname
   var vformname = arguments[5];
   	 if(!vformname){
      vformname = "Global_Messagebox"
     
   }
      
   //form weg
  
      solutionModel.removeForm(vformname);
  
	  
   //neue form definieren
    
   var vDialogForm = solutionModel.newForm(vformname,null,null,'style_messagebox', false,vWidth,vHeight);
   
   vDialogForm.navigator = SM_DEFAULTS.NONE;
   vDialogForm.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_AS_NEEDED | SM_SCROLLBAR.VERTICAL_SCROLLBAR_AS_NEEDED;
   vDialogForm.borderType = 'LineBorder,0,0,0,0';
   
   
   vDialogForm.RECORD_VIEW;
      
   //LABEL DEFINIEREN UND MESSAGETEXT EINFÜGEN
   var vMessageLabel =  vDialogForm.newLabel(vMessage, 20, 20, vWidth-20, vHeight-40);
   vMessageLabel.transparent = true;
   vMessageLabel.anchors = SM_ANCHOR.ALL;
   vMessageLabel.verticalAlignment = SM_ALIGNMENT.TOP;
   
   // button methode
   var jButtonMethod = vDialogForm.newFormMethod('function BTN_click(event){ \
      globals.g_dialog_antwort = event.getElementName() ; \
      application.closeFormDialog(); }  ');

   var vButton, vButtonName;
   var vX = 20;

   //wurden buttons übergeben ???
   if(vButtons.length > 0)
   {
      //plugins.dialogs.showInfoDialog(" ",vButtons,"OK");
      
	   vX = vWidth - (110 * parseInt(vButtons.length)) - 15 ;

       //buttons in die form
      for(var i in vButtons)
      {
         vButtonName = vButtons[i];
         vButton = vDialogForm.newButton(vButtonName, vX, vHeight-52, 100, 22,jButtonMethod);
         vButton.name = vButtonName;
         vButton.anchors = SM_ANCHOR.SOUTH | SM_ANCHOR.EAST
         vX = vX+110;
      }
   }
   
   
   //Form anzeigen
   application.showFormInDialog(vformname,-1,-1,vWidth,vHeight,vTitle,false,false,vformname,true);
   //application.showFormInDialog(form,[x],[y],[width],[height],[dialogTitle],[resizable],[showTextToolbar],[windowName],[modal])
}

From my form i call:

function m_neuer_kontakt() 
{

	var meldung = "Wollen Sie einen neuen Kontakt für das Objekt " + globals.g_knotenid+" anlegen?";
	globals.g_dialog_box("Hallo",meldung,['OK','ABRUCH'],'500','100',"Warten");
		
	
	if (globals.g_dialog_antwort == 'OK' )
	{
		
	forms.Neuanlage_Kontakt.controller.newRecord(true);
	forms.Neuanlage_Kontakt.rbkontaktid = "auto";
	forms.Neuanlage_Kontakt.rbobjekteid = globals.g_knotenid;
	forms.Neuanlage_Kontakt.projekt = globals.g_startprojekt;
	forms.Neuanlage_Kontakt.rbkontaktmelder = globals.g_uservorname +' '+globals.g_usernachname;
	forms.Neuanlage_Kontakt.rbkontakttelefon = globals.g_usertelefon;
	forms.Neuanlage_Kontakt.rbkontaktmail = globals.g_usermail;
	forms.Neuanlage_Kontakt.rbeingangsdatum = application.getServerTimeStamp();
	forms.Neuanlage_Kontakt.rbkontaktstatus = "offen";
	forms.Neuanlage_Kontakt.rbmeldeart = "Online";
	forms.Neuanlage_Kontakt.angelegt = application.getServerTimeStamp();
	forms.Neuanlage_Kontakt.a_benutzer = globals.g_username;
	
	var parten = application.getValueListItems('Liste_Kontaktprioritaeten').getColumnAsArray(1); 
	forms.Neuanlage_Kontakt.prioritaet = parten[0];
	
	var koarten = application.getValueListItems('Liste_Kontaktarten').getColumnAsArray(1); 
	forms.Neuanlage_Kontakt.rbkontaktart = koarten[0];
	
	application.showFormInDialog(forms.Neuanlage_Kontakt,10,10,800,700,"Neuanlage Kontakt",true,false,"Neuanlage_Kontakt",true);	
			
	}
	else
      {
      application.output("else = " + globals.g_dialog_antwort);
      }
}

In Smartclient everything works as expected.
In Webclient the function is executed and i immediately get the application.output “else”
Then the messagebox is shown but the click on OK does nothing(No form Neuanlage_Kontakt) ???
Is the modal showformindialog in Webclient not working or what else do i miss ?

Help urgently needed
Best regards
Albert

Hi Albert,

In web client the Form In Dialog (FID) (or even the dialogs in 6.0) don’t pause the code once it opens the dialog like it would in smart client.
You can solve this by using JavaScript Continuations (in web client only).

A couple of weeks ago I published the OpenSource Dialog module that takes care of this for you.
You can simply replace all your modal FID/Dialog calls with the ones from the module and your dialogs work the same in smart and webclient.

https://www.servoyforge.net/projects/mod-dialog

Hope this helps.

Hello Robert
I downloaded the modul.

I tested.
Everything works as expected.
Thank you yery much.
Regards
Albert