Simply create an array with the values and check for duplication.
var formdata=new Array();
formdata[0]=document.getElementByid('id').value;
formdata[1]=document.getElementByid('id').value;
formdata[2]=document.getElementByid('id').value;
Now check for duplications in the array using the following - I guess the following question would be useful on stack overflow:
Easiest way to find duplicate values in a JavaScript array.
If the breakpoint is one simply display an alert() to the user to renter the data.
Instead of using documents.getElementById() you can also use
oForm = document.forms[index];
oText = oForm.elements["text_element_name"].value; OR
oText = oForm.elements[index].value;
More information can be found at:
http://www.javascript-coder.com/javascript-form/javascript-get-form.phtml