How to get rid of form validation redundancies?

In the code below, ProductName and MatName use the same validation script. How can I use variables to to reduce the script to one subfunction?

Code (Text):

 

 

 

<script>

<!–

 

function ValidateInLine(theForm)

{

 

  if (NewProductForm.ProductName.value == "")  {

    document.getElementById("nameError").innerHTML = "Please enter the Name of your Product:";

    document.getElementById("nameError").style.display = "block";

     document.getElementById("nameError").scrollIntoView();…

How to get rid of form validation redundancies?

See original post by wpprod

Leave a Reply