I have a PurchaseOrders table that looks like this:
poid (pk, autoinc)
posuppid (references suppliers.suppid)
Dragging that table to a form section gives me the fields, now I don’t want the user to capture posuppid as this is already known so I want to fill this with a valid supplier id, say ‘2’.
The first approach I tried was to leave the posuppid field on the form and set it like this:
loSec = Lianja.get("Purchase_Orders.section1") loSec.add() lfFld = Lianja.get("Purchase_Orders.section1.field5") lfFld.value = 2
All looks ok onscreen until I save, then posuppid is set to 0 and the record is saved without the value being set.
So my question is – what is the best way to update a field like this, should I maybe be setting it directly on the table and not on-screen,
UI controls are bound to a data source. Changing the data source and refreshing the control it is bound to should be done.
Programmatically updating the UI control does not update the data source.
replace purchase_orders.posuppid with 2 Lianja.getElementByID("purchase_orders.section1.fi eld5").refresh()
You have to select the correct cursor first.
If you select a cursor save the active one first and restore it afterwards. See SELECT and SELECT()