The CreatorCon Call for Content is officially open! Get started here.

Learning Oldvalue - It returns an empty value

PurviP
Tera Contributor

Problem Statement: 
When oldValue is used in onChange client scripts, it always returns an empty value.

An example:

onChange client script depends on the Short description field. When the client script triggered, the oldValue is returning empty instead of what the user previously entered in the Short description field prior to saving the change.

Client Script:

g_form.addInfoMessage('<b> old value: </b>' + oldValue + ' ||  <b> New value: </b>' + newValue);





1 REPLY 1

J Siva
Kilo Patron
Kilo Patron

Hi @PurviP 
The old value refers to the value that was previously stored in the database. If you are working on a new record, the old value will always be empty until the record is saved. Once it is stored in the database, any subsequent time the client script is triggered, it will retrieve the last stored value from the database as the old value.

It will not display the data that the user just typed but hasn’t saved in the database.

 

Regards,
Siva