The following sample code added to the Form actions -> on add -> on validate block and Form actions. -> on edit -> on validate block of the Script tab, will check if the same team member is added more than once to the Team Member form. If true, the submit action will cancel.
if (count(team_member[name == input.name]) > 0) |
where,
team_member [name == input.name] - selects all the records from the team_member form whose name is equal to the name entered in this form.
input.name - it is the value for the field "name" given by the user while submitting the form
count - count operator returns the number of team members whose name is equal to the current name in the form (this.name)