<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Jeffrey,</p>
<p>Can you please open an issue on Github (<a href="https://github.com/qgis/QGIS/issues">https://github.com/qgis/QGIS/issues</a>) and include your DDL SQL statements you used for these tests - including all pkey/fkey and other constraints you used and a simple QGIS project file demonstrating the issue. It is easier to discuss such issues on Github.</p>
<p>Maybe it is related to the fact that Comboboxes aren't properly initialized with NULL values, for cases that don't allow NULL values.</p>
<p>This is important to investigate - as it is unacceptable that corrupt data is collected.</p>
<p>Thanks,</p>
<p>Andreas</p>
<p id="reply-intro">On 2020-09-15 04:32, Jeffrey Durrence wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">
<div>
<style type="text/css">#replybody1 p, #replybody1 li { white-space: pre-wrap; }</style>
</div>
<div>Today I was trying to set up an edit form for a spatial table with a related, non-spatial table.  I have done this many times in the past, but it's been a while.  After using Project Properties to set up my relation, I made several attempts to add a new record in the "child" table.  Each time I tried, the new record did not get the correct value for the field which relates the two tables.  Existing records were displayed as expected and could be edited, but I could not add new features.</div>
<div> </div>
<div>I went to the docs to see if something had changed that might be affecting me.  I downloaded sample shapefile data and used that to demonstrate that related records could be created with that data.  I set up a clean database and QGIS project file and made several attempts with my PostGIS data.  I did observe that some new options were available to me under the widget area of the child table.  What had me confused was that with the default options selected (the way I used to do it), the "reference field" values generated for the "new" child records were real values -- just not at all the correct values.</div>
<div> </div>
<div>I tried several things with the PostGIS data, but what finally fixed the behavior for me was to make one change in the default Widget settings for the "reference field" in the child table properties.  In my case, enabling the option to "Use a read-only line edit instead of a combobox" resolved the issue.  When that is enabled, new child records get the correct value for the reference field.  I don't completely understand what determined the inserted values when this option was not enabled,  but I would think that enabling this by default would save a lot of confusion for users like me.  I was quite surprised that I could not find folks talking about this in the usual places.  Could be that there is something local to my environment, but I thought it worth mentioning should someone else stumble upon it.</div>
<div> </div>
<div>Using QGIS LTS (3.10.5) on Ubuntu 20.4 and Windows 10 64-Bit with PostGIS backend (observed same behavior with Postgres 10.14 / PostGIS 2.4.4 and Postgres 12.4 / PostGIS 3.0.0)</div>
<div> </div>
<div>--<br />Jeffrey Durrence<br />jeffrey.durrence@mcleanengineering.com<br />McLean Engineering Company<br />815 South Main Street<br />Moultrie, GA  31768<br /><br /></div>
</div>
</div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br />Qgis-user mailing list<br /><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br />List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br />Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></div>
</blockquote>
<p><br /></p>

</body></html>