I am building a time sheet. Inside this time sheet i have two columns. One column is labeled Hours and the other is labeled Hours Description.
The fields are labeled under these columns as follows:
Column Name Hours Hours Description
Field Name Hours1 HoursDesc1
The user will input their hours in Numeric Field "Hours1" and will enter an abbreviation in Text Field "HoursDesc1", for example "A" for Administrative Leave or "C" for Compensatory.
I want to build a script that if Text Field "HoursDesc1" equals "A" or "C" then display Numeric Field "Hours1", else equal 0. If they enter anything other than "A" or "C", the result will be zero.
Custom calculation code for the text field in question:
var desc = this.getField("HoursDesc1").value;
if (desc=="A" || desc=="C")
event.value = this.getField("Hours1").value;
else event.value = 0;
Thanks Gilad D, you were very helpful. Have a great day!