Latest versions of SC broke some code I wrote in forms events that was getting some fields values correctly before the upgrades
Issue #1: virtual fields set as dates - code gets wrongly formatted value
E.g.
- virtual field “fieldname” set as date
- display format: dd/mm/yyyyy
- form is run on an existing record
- field value: 31/03/2021
- what the code run in an event gets as field value:
- before the upgrade: “2021-03-31” (note that his is the correct sql date format)
- after the upgrade: “31032021”
- What’s wrong after the upgrade: “31032021” is not a properly formatted date value for db insertion (what I used the read value for) while the value that was returned before (“2021-03-31”) was
Issue #2: real fields set as “Document (File Name)” - code gets value only once (if any)
E.g.
- real field “fieldname” set as “Document (File Name)”
- code to get the the value of {fieldname} is in the onBeforeUpdate event
- form is run on an existing record
- field value: “filename.txt”
- what the code gets as field value when the save button is pressed many times with no change to the field value:
- before the upgrade: “filename.txt”, all the times the save button is pressed
- after the upgrade: “filename.txt” the first time the button is pressed and “” (no value) from the second time the button is pressed on.
- What’s wrong after the upgrade: the code is only able to read the field value in the onBeforeUpdate event on the first pressing of the Save button; after that, anytime the button is pressed (no change to the field value) the code will get no value
- Note: after the upgrade, when the same code is in a PHP or AJAX button it will always fail to read the field value, but I’m not sure this was working before the upgrade
I’m not sure which versions of SC created the above described issues.
I’m now on SC 9.6.007