I have a question that I haven’t been able to answer for myself, so I thought I’d ask here. It may be something totally obvious, but I’m missing it.
I have a form. I put 2 fields on it. Both fields are “fed” by valuelists. Both fields are set up as comboboxes. The valuelists have “allow empty value” so that I have a blank line at the top of each valuelist when I use it in a combobox.
When I run the form in the smart client…
One of the fields has a white background, and has the dropdown arrow. I can type in the field, which I can then use to trigger an “onDataChange” event, where I can see if the item they typed is in the list, and if not, ask them if they want to add it.
The other field displays greyed out and has the dropdown arrow, almost looking like a button, and while I can select from the combobox, I can’t type in the field. “editable” is checked.
I actually have about 25 fields on this form, and 3 of them are showing up greyed out. For the life of me, I can’t figure out what’s different about them, which probably means it’s something really obvious that I’m oblivious to.
Any clues as to where to look? As always, thanks for you advice. Certainly appreciated.
The white fields have “editable” checked and the grey ones not.
The valuelists on the white fields display exactly what is in the field and the valuelists on the grey fields have a separate display value and real value.
Thanks for that information. It turns out that the answer was #2. The fields that are greyed are all displaying one value and returning another in the dataprovider.
Is there a way to work around that so that I can get the look and the behavior that I need so that the fields on the form look at act consistently? Actually, one returns 2 values in the dataprovider, which I’ve been handling by putting them into an array and parsing them that way. The other shows a display value but actually puts a record key into the table. The only thing that comes to mind would be to change the valuelists to just put the display value into the form and the data provider, and then get the values I actually need behind the scenes before I write out the records.
As a reminder, what I’d like the field to do is let them pick from a list in the combobox or type in their own value. The onDataChange would sense this, look up the value to see if it’s in the table and if not, ask if they want to add it. If yes, for simple tables, it just adds the item to the list. For more complex tables with other data, I open a modal form that allows them to enter the rest of the data. In the old Access system I’m converting from, we had them just doubleclick on the field to add new data by opening a little maintenance form, but fields on a Servoy form don’t have a doubleclick event. I could use right-click with a dialog, but that seems somehow less intuitive, although I think that could work, correct? Potentially, I could make all of the combobox fields non-editable, but respond to a right click with a little dialog to ask if the want to add new values.
in servoy if you have a valuelist that has real and display values it is not allowed to type into that field
Because the thing that is typed freely must mapped on a real value, also in ondatachange you get the real value already not the typed value which is just a render value its not a value of the data layer.
just think about that you have name->id valuelist now a user can just type a new name, what should that id be?? we can’t map that.
You could try to handle that yourself by using a global method valuelist and a typeahead field using that valuelist.
Thanks for that information. I’m going to mull that over a bit, but I think I understand what you’re saying.
What I do now with the fields that allow for data entry is to use the onDataChange to see if the field is already in the valuelist, and if it’s not, I ask them if they want to add it. If they answer “yes”, then I create the new record in the table that underlies the valuelist.
I’ll explore what you mentioned, as well as what I was commenting about above, ie, using a right-click event to handle things on all of the fields, and go from there.