I have the following HTML code:
<form name="Register" action="Register.aspx" method="post" runat="server" style="margin-top: 15px;" onsubmit="return validateProfile(FormName='Register');" >
<p> Name* : <input id="FirstName" type="text" name="FirstName"/> </p>
<form>
And this JavaScript code:
function isEmpty(field) {
if (field == "" || field == null)
return false;
}
function validateProfile(FormName) {
var errFname = "";
var Fname = document.forms[FormName]["FirstName"].value;
alert(isEmpty(field=Fname));
return false;
}
The problem here is that the validation doesn't work...
I want that if the field is empty there will be an alert message. The solution might be very simple, but I just start leran this validtion with javascript.
I have to used the isEmpty function in the code.