WebPopUpMenu Empty RowTag


I populate a WebPopUpMenu (“RolePopUpMenu”) with user roles from a PostgreSQL database. I want the RowTag to be the field “id” (auto-increment field in my “user_roles” table) and the field “type_role” to be shown in the WebPopup.

I use this Method “FeedRoles(PopUpMenu As WebpopupMenu)” to populate my “roles” WebPopUpMenu which is placed in a WebContainer (EC):

[code] PopUpMenu.DeleteAllRows
Dim RCRoles As RecordSet
Dim strSQL As String
Dim x As Integer 'for value verification
Dim y As String 'for value verification

strSQL = “SELECT * FROM user_roles”
RCRoles = Session.db.SQLSelect(strSQL)

If RCRoles <> Nil Then
While Not RCRoles.EOF
PopUpMenu.RowTag(PopUpMenu.ListCount-1) = RCRoles.Field(“id”)
x = PopUpMenu.ListCount
y = PopUpMenu.RowTag(PopUpMenu.ListCount-1)
End If

strSQL = “”

My “user_roles” table contains :


It seems to work fine, since I get the values ‘1’ and ‘2’ for the respective iterations for [y As String] and my WebPopUpMenu is Populated as expected.

The problem occurs when I try to retrieve the RowTag to UPDATE my “users” table with the WebPopUpMenu RowTag value (“id”) to link the user to it’s role.

I use this code in an «action event» of my «modify button».

[code] //Vérifier si un nom de projet a été entré
If NameField.Text = “” Then
MsgBox(“Vous devez minimalement ajouter le nom du projet.”)
End If

//Déterminer l’ID de l’employé
Dim EmpID As String
Dim RoleID as String
Dim x As Integer
Dim y As String

x = UsersPage.EC.RolePopupMenu.ListIndex
y = UsersPage.EC.RolePopupMenu.RowTag(1) 'for testing RowTag value

EmpID = UsersPage.SBCEmp.EmpListBox.RowTag(UsersPage.SBCEmp.EmpListBox.ListIndex)
RoleID = UsersPage.EC.RolePopupMenu.RowTag(UsersPage.EC.RolePopupMenu.ListIndex)

//Update des données de la BD
Dim RC As RecordSet
Dim strSQL As String

If Not Session.db.Error Then
strSQL = “UPDATE users SET user_name = '” + SafeSQL(NameField.Text) + “’, user_adresse = '” + SafeSQL(AddressField.Text) + “’, user_email = '” + SafeSQL(EmailField.Text) + “’,” + _
" user_tel = ‘" + SafeSQL(TelField.Text) + "’ , user_login = ‘" + SafeSQL(UserField.Text) + "’, user_password = ‘" + SafeSQL(MPField.Text) + "’, user_roles = ‘" + RoleID + "’" + _
" WHERE user_id = ‘" + EmpID + "’"


If Session.db.Error Then
  MsgBox("DB Error: " + Session.DB.ErrorMessage)
  MsgBox("Les données de l'employé ont été mises à jour")
End If

MsgBox("DB Error: " + Session.DB.ErrorMessage)
End If

When the code executes, y is empty and an error occurs when the strSQL is executed. What do I do wrong?


Seems like this should instead be:

PopUpMenu.RowTag(PopUpMenu.ListCount-1) = RCRoles.Field("id").IntegerValue

Thanks you very much!

You solved it once again!