I have created a custom form (for mapping bird species in the field with different attributes like species, type of observation, number of birds, date, ...) with some Python logic.
One important feature of the Python logic is to provide a custom drop-down list with the possible species. A list of the most recently used species and the most often used species are added before adding the complete list of species. This way I want to minimize the amount of scrolling needed, because scrolling on a small tablet PC in the field is quite time consuming.
The form opens fine and shows the existing values (in the case of editing an existing feature). I can work with all fields as I want to, including the custom dropdown lists.
But when I finish the form by clicking the "OK" button, the changed values (in the case of editing an existing feature) or the new values (in the case of a new feature) are not written back to the attribute table of the shapefile.
So here is my question:
How can I force QGIS to write back all edited values to the attribute table??
I tried different commands like:
currentFeature.setAttributes() currentFeature.setAttribute() currentLayer.updateFeature(currentFeature)
but nothing has worked and I find contradictory / confusing information about these commands in the net. I guess these commands were modified in the last versions of QGIS.
System: Windows 7 64
QGIS Version: 2.8 (tried before with older versions with same result)
Python Version: 2.7