Custom calculation script to omit field if it is hidden
Hi,
I am converting a document to a form and there is a ratings section with 6 categories where a rating of 1 to 5 is given. A read only field Total-Score calculates the ratings given for each category.
However, one category Kitchen, is only required if it a kitchen is present. Thus, a radio button with Yes and No option is present and if Yes is selected, the Kitchen-Rating field goes from hidden to visible, allowing the user to enter a rating. Otherwise, if No is selected, the field remains hidden.
How do I go create a custom calculation script to sum up these fields yet factor in the change of state of the Kitchen-Rating field, i.e. if hidden it is not included and if visible it is included? Below is my attempt to create the script but I receive the error message "SyntaxError: missing : after property id 3: at line 4".
if (this.getField("Kitchen-Rating").display = display.visible);
event.value = {
this.getField("Bathroom-Rating").value + this.getField("Beds-Rating").value + this.getField("Kitchen-Rating").value + this.getField("Walls-Rating").value + this.getField("Furniture-Rating").value + this.getField("Safety-Rating").value
} else event.value = {
this.getField("Bathroom-Rating").value + this.getField("Beds-Rating").value + this.getField("Walls-Rating").value + this.getField("Furniture-Rating").value + this.getField("Safety-Rating").value
};
Any suggestions on where I am going wrong?
Much thanks in advance.
Tim
