How do I set the value (text) in a web PopUpMenu? What I do is load data from a database into a form… the Popupmenu should show the value that is stored in the database and the user can then change the value by selecting a different row / value from the popupmenu.
This was working in Xojo 2019.r3 but with the changes the code / properties instituted since then my code no longer does this function.
That does let me READ the value of the popupmenu… how do i SET the value of the popupmenu? I used to just popupmenu.text = some-text but that no longer works
I have a form that loads client data… one of the data points is contained in a set of choices in a popupmenu on the page. The client can change that data to one of the other choices, but when the information is loaded I want that popumenu control to show the data that was previously saved and was just retrieved from the database.
var rs as RowSet
//db is the database
try
rs=session.db.SelectSQL("SELECT ColumnName from TableName WHERE Your Criteria Here")
if rs<>nil then
YourPopupMenu.RemoveAllRows
while not rs.AfterLastRow
self.YourPopupMenu.AddRow rs.Column("ColumnName").value
rs.MoveToNextRow
wend
end if
Catch error as DatabaseException
MessageBox ("Error: " + error.Message)
end try
Maybe you read my post as #1 instead of #2. #1 read the value of the popupmenu #2 set the value of the popupmenu using the value that you provide, for example: value retrieved from the database