I have read several documentation on the combobox in Maintain as well as some Focal Point discussion on the topic but I am still confused.
This is what I'm trying to do. I have a single-select combobox on a form that is bound to a field in a stack. The options for this combobox is added by using the "As Entered Here" radio button on the list property. I manually entered the Text and its corresponding value in the property.
Adding a new record works fine (just like the other focal point post on this same subject). Now, I want to update (okay, don't roll your eyes just yet). The stack is now filled with the current value on the database. And so, the doc says not to bind this thing to a pre-filled stack because it will just overwrite what is in there. So, I bound this combobox to a scratch variable instead and created a hidden textbox that is bound to the stack field. after the "update button" is clicked, then it copies the value of the variable to the stack. It makes sense theoritically.
So, my first problem is setting the selectedIndex to the proper value before the form is shown. The example on the doc says to put the options in a stack, cycle through it on winform show_inactive, yada yada. Well, in my case, the options are not in a stack - they're manually entered in the "As Entered Here" thingee. So, what I did instead is to put a javascript on the form onload event and did something like this (okay, this is off the top of my head, so syntax errors may occur, but the point is the logic, not the syntax):
for(i=0;i "less than" document.form1.mycombobox.length;i++){
if (document.form1.mycombobox.options(i).value == document.form1.stackfield.value){
document.form1.mycombobox.selectedIndex = i;}
}
** the less than symbol doesn't show up right in the post, but y'all probably already know that.
Well, this didn't work - because, for some crazy reason, if I do a view source on the form when it runs, the actual VALUE of the options are changed to selectedIndex+1! So, it will never be the same as the value of the stackfield.
If I look at the .mnt file using notepad, the value for the options is what it should be, so I guess webfocus changes it at run-time/compile time somehow.
So, I guess this is not the way to do it... what's an easy way to do this?
I'm on 7.1.4 running on windows.
WF 8.1.05 Windows