Write a code for "RequiredFieldValidator" in java script
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / manoj
suppose the id of the field required to be validated is
NameId
Thus:-
function validate()
{
if(document.getElementById("NameId").value == null)
alert("Please enter the name");
}
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / amit patel
function validate()
{
if(document.getElementById('<%=Name.ClientID%>').value
== "")
alert("Please enter the name");
document.getElementById("Name").focus();
return false;
}
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / jayamala
function validate()
{
if(document.getElementById("NameId").value =="")
alert("Please enter the name");
document.getElementById("NameId").focus();
return false;
}
Is This Answer Correct ? | 4 Yes | 4 No |
Answer / sudhakar sakthivel
function validate()
{
if(document.getElementById("NameId").value == null ||
document.getElementById("NameId").value.trim()=="")
alert("Please enter the name");
document.getElementById("NameId").focus();
return false;
}
Is This Answer Correct ? | 0 Yes | 1 No |
What is shared and private assembly?
What is distributed system in asp.net?
In which module you have worked in your .net project explain?
cr8 2 datatables into one dataset DYNAMICALLY (no backend database used like sql,etc.,) with following columns 1st datatable with columns studentNo studentName Deptno 2nd datatable with columns Deptno DeptName DeptAddress add data to both the tables Dynamically and merge these tables into one table and display it in Grid view as studentNo studentName Deptno DeptName DeptAddress
To which class you load XML or Related Data
When a dropdownlist has been added by some records and it has been binded why it is not executing i'm facing this error pls help me ? if (is!pageposback) { arraylist books = new arraylist; books.add ("gone with the wind"); books.add ("rahulsriramprakash"); books.add ("vishal"); dropdowndisplay.datasource=books; dropdowndisplay.databind(); } The error is : 1) The dropdowndisplay does not exist.
What is MVVM in dot net?
how to retrieve property settings from xml .config file.
When should I use server transfer and response redirect?
Explain the use of resource manager class in .net.
how to edit gridview control in asp.net2.0
What is the other method, other than GET and POST, in ASP.NET?