JavaScript is a most popular client-side scripting language.

Here, I have shown a function named CheckForm which when called checks if the vaue for the txtInvNum input textbox is set or not. If not, it shows message and returns false.

 

<script language="Javascript">

 

function CheckForm()

{         

           

if (document.formRS.txtInvNum.value = "")

            {

                        error = "Error: Invoice No. is Compulsoroy";

                        alert(error);

                        return false;

            }

            else

            {         

                        return true;

            }

}

 

</script>

 

 

The function can be called on press of button or  label as shown below

 

<LABEL onclick= CheckForm()> Check Form </LABEL>

0 comments: