Hi,
I have a bit different scenario but the same problem. I'm trying to store an item value to viewScope in any onload event (I've tried them all). The idea is to check if value has changed when user saves. I've tried these:
- getComponent("FieldName").getValue() causes error 'getComponent()' is null
- datasourcename.getItemValue("FieldName") causes error [ReferenceError] '
datasourcename' not found
This is a Custom Control and I'm using 8.5.3. How do I get item value when page is loaded?
EDIT: Now I realized I need to use the control ID when using getComponent. When I did that change, I don't get an error any more, it just returns null even when there is a value in the field. It is a Multiline Edit Box.
EDIT2: I was able to achieve what I want by getting the old value from the document in save button onclick event:
database.getDocumentByID(datasourcename.getNoteID()).getItemValue("FieldName")
EDIT3: Looks like I can get the old values simply this way:
datasourcename.getDocument()
Still it would be interesting to know the answer to the original question.
thanks,
- Panu