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

Name the method that needs to be invoked on the dataadapter control to fill the generated dataset with data?

542


Why session management is required?

542


How many types of file extensions for razor views in ASP.Net MVC?

580


Define tracing.

630


Why do we need master page in asp.net?

533






What is the server of asp.net?

514


What is the use of asp.net web api?

585


Will the asp.net validators run in server side or client side?

646


Are there any resources for drop-in replacements for the default css that comes with the ASP.NET Website template?

565


What is the latest version of asp.net?

539


What do you mean by caching in asp.net?

552


Please brief not about xsd,xslt & xml?

546


IN an ASP.NET Web application if there is any error, how can you debug?

587


What are html helpers in asp.net?

531


Is it possible to apply themes to an asp.net application? If yes, then how?

580