I have a form that once a facility is selected from a drop down which is fed off an SQL query the equipment size is next to be selected. When you switch facilities is automatically generated in the label of the equipment field. How can I make sure that a field is selected from the drop down before the user moves on to the next screen. I am passing these parameters onto the next form that the operator is using.
You just need to check that the selectedValue property of the dropdown doesn’t equal -1.
id = event.source.parent.id
devicename = event.source.parent.getComponent('Device ID').text
displayname = event.source.parent.getComponent('Device Name').text
message = event.source.parent.getComponent('Text Area').text
username = event.source.parent.getComponent('username').text
time = event.source.parent.messagedatetime
timetext = event.source.parent.messagedatetimetext
if message == "":
system.gui.messageBox("Please enter a message")
elif timetext == "":
system.gui.messageBox("Please enter your specified date/time")
system.db.runPrepUpdate("INSERT INTO memos (devicename, displayname, message, username, time) VALUES (?,?,?,?,?)", [devicename, displayname, message, username, time])
here is something you can work off of. If text area component,etc is blank it pops up a gui and tells them to enter a message. in your case you would want to check the selected value. in my case if both if statements are met, it runs an insert query then closes the window. in your case it sound slike you would do a swap window and pass the variables on to the next window.