RequiredFieldValidator--write code in javascript

Answer Posted / amit das

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

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how dot net compiled code will become platform independent?

602


Explain why it is useful to use mvc instead of webforms? : asp.net mvc

699


How can we create custom controls in asp net?

632


What is a session in asp.net?

635


How would ASP and ASP.NET applications run at the same time on the same server?

2033






What are the best practices to follow to secure connection strings in an ASP.NET web application?

646


What is distributed system in asp.net?

638


Can master pages be nested?

601


Why would anyone need to implement their own hashtable or linked list?

2542


What are the new navigation controls in asp.net 2.0?

616


Can you change a master page dynamically at runtime? How?

601


What is Pre-Render event in ASP.NET?

678


What is a session government?

581


Explain the concept of event bubbling in ASP.NET?

682


What are session state modes?

654