Hi
I wonder if someone could assist me with some script to check for errors. I have the following which works fine when I click my submit button but I think there is way of writing it without having to detail each field / behaviour etc. In my Action field, I have 10 choices, for this one Ive selected Appointment Ongoing then a number of checks. I would also need to rerpeat these checks for other options in the Action field. Would appreciate any assistance.
Regards,
Michael
//Appointment Ongoing
if (getField("Action").value == "Appointment Ongoing"){
//Check Cost Code
if (this.getField("From_Cost_Centre").value =="Select Cost Centre"){
app.alert("Information Error!\n\nPlease select "+ getField("Employee").value +"'s current cost centre.");
this.getField("From_Cost_Centre").textColor = ["RGB",1,0,0]; //Change text to red
} else {
//Check Position Title
if (this.getField("From_Position_Title").value ==""){
app.alert("Information Error!\n\nPlease enter "+ getField("Employee").value +"'s current position title.");
this.getField("From_Position_Title").strokeColor = ["RGB",1,0,0]; //Change text to red
} else {
//Check Position Number
if (this.getField("From_Position_Number").value ==""){
app.alert("Information Error!\n\nPlease enter "+ getField("Employee").value +"'s current position number. For assistance with determing position numbers please contact Human Resources.");
this.getField("From_Position_Number").strokeColor = ["RGB",1,0,0]; //Change text to red
} else {
//Check Reports To
if (this.getField("Current_Reports_To").value ==""){
app.alert("Information Error!\n\nPlease enter the title of the person "+ getField("Employee").value +" currently reports.");
this.getField("Current_Reports_To").strokeColor = ["RGB",1,0,0]; //Change text to red
} else {
this.mailDoc({
cTo: getField("Authorising_Manager").value,
etc