drag and drop, then get focus?
we have a list layout with an externally stored (open) container field. The layout simply shows a list of records each with one image and a few text fields. We allow the user to drag and drop an image onto the container field.
We are running into a problem if the user doesn’t FIRST select the record they are dragging the image on to.
Basically we have a script trigger on the container field with an “onObjectModify” trigger that sets the images FileName in a text field.
So the user drags and drops, and the script immediately runs setting FileName to be “GetAsText(image)”.
If the user is working on the selected record, everything works great. The image gets stored and the field name is set correctly.
The problem is when the user has a different record selected, the user drags and drops and the image stores correctly, but the focus is still on another record, so the set field command sets the text field in the wrong record to the wrong value.
To use an example, let’s say the layout shows a list of 5 records, each record has one image and one text field. If the currently selected record is the first one in the list, but the user drops the image onto the third record’s container field, the image is stored in record 3, but then as the ‘onmodify’ script gets triggered, it changes the fieldname text field on the first record to the file name of the first record’s container.
Ideally I want to find a way that when the user drags the image on the third record, the script selects that particular record (changes the focus) … and then changes the data on that record, but I can’t figure out how to do that.
So … user drags onto the third record, image gets stored, context gets changed to record three, then set fields work correctly.
The current situation is very confusing for the users, because they drag the image on a certain record and they see the image change … so they assume it is changing the correct data, but then another record’s data is changed instead.
On a related note, I ran a test to see which script triggers fire, the only trigger that seems to work is “onObjectModify” … the other triggers never fire since I assume we technically never enter (or exit) the field.
Any suggestions on how to change the context/focus to the record that the image is actually stored in?