Write a code for "RequiredFieldValidator" in java script

Answer Posted / rajikiran

function validate()
{
if(document.getElementById("NameId").value == null)
alert("Please enter the name");
document.getElementById("NameId").focus();
return false;
}

or

function validate()
{
with(document.formname)
{
txtboxid.value == ""
alert("Please enter value");
txtboxid.focus();
return false;
}
}

or we can use

document.form.txtboxid.value

instead of

document.getElementById("NameId").value


regards
rajikiran

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is cookie used in asp.net?

767


Write code to send e-mail from an asp.net application?

752


What is the difference between ldap and active directory?

749


Explain the namespace classes used in asp.net mvc? : asp.net mvc

724


What is the equivalent of date() and time() in asp.net?

716


Are cookies stored on server or client?

716


How can we pass info between 2 asp.net pages?

756


Is it true that a Web service must be written in .NET or not?

804


Explain about asp.net 2.0 themes?

717


What are server activated objects?

826


What is the function of the ViewState property?

805


Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?

734


Name the two properties are on every validation control?

726


How do you hide the columns?

764


Define web services in asp.net.

742