B4J Question WebApp: Selector not updated

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi All,

have developed a simple webapp sendmail (another B4JHOWTO using jQuery Mobile).
The mail is sent using SMTP. This works all fine, but after the mail is sent a selector ("lblfooter" as defined in the index.html) is not updated in the html file.
If clicking on a dialog, like about button, the selector is updated.
The same happens if instead of updating a label, a ws.Alert is used.
It seems the connection to the websocket in put on hold after SMPT send is used.
See attached project.

Questions: Any ideas how to fix = selector or showing an alert after email has been delivered (or not)?

B4X:
Sub SendEmail
...
smtpEMail.Initialize with Event SMTP
smtpEMail.Send
...
End Sub

Sub SMTP_MessageSent(Success As Boolean)
Dim msg As String = DateTime.Time(DateTime.Now) & " :: Mail sent "
If Success = False Then
  msg = msg & "error."
Else
  msg = msg & "successful."
End If
' THIS DOES NOT WORK STRAIGHT - The label is updated after f.e. button About was clicked
lblFooter.SetText(msg)
End Sub
 

Attachments

  • B4JHowToWebAppSendMail.zip
    9.6 KB · Views: 214

billzhan

Active Member
Licensed User
Longtime User
Rob,

The js functions called by SMTP_MessageSent are server event(not from the client, so ws.Flush should be called.

B4X:
    lblFooter.SetText(msg)
    ws.Flush

Again,It's a nice work.

Cheers,
bz
 
Upvote 0
Top