Checking for a integer key field named “id_prj” on a form app.
On a (not yet inserted) new record on the onLoad event, this code:
$m = empty({id_prj})
? "empty id"
: "id_prj = '" . {id_prj} . "'";
echo $m;
sc_alert($m);
will show, correctly, this:
empty id
But if the same code is run from an an Ajax event of one of the form fields, still on a not inserted new record, it will show:
id_prj = ‘undefined’
I.e. the empty integer field has the string “undefined” as its value.
Why?
Not sure, but i think this was not the case in past SC versions (no idea when this behavior was introduced).
This is definitely a dangerous bug for all code run on ajax events of form fields.