Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a code for "RequiredFieldValidator" in java script

Answers were Sorted based on User's Feedback



Write a code for "RequiredFieldValidator" in java script..

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

Write a code for "RequiredFieldValidator" in java script..

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

Write a code for "RequiredFieldValidator" in java script..

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

Write a code for "RequiredFieldValidator" in java script..

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

Write a code for "RequiredFieldValidator" in java script..

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

Post New Answer

More ASP.NET Interview Questions

What is difference between user control and custom control?

1 Answers   TVS,


Explain the different parts that constitute ASP.NET application?

0 Answers   B-Ways TecnoSoft,


How would one do a deep copy in .NET?

6 Answers   TCS,


Explain the difference between the web config and machine config.

0 Answers  


How can u handle Un Managed Code Exceptions in ASP.Net?

1 Answers   Lara Technology,


When should we use abtract class and Interface Class?Give an Example

4 Answers   Accenture, Cap Gemini, L&T, RM,


Can we change the page layout in ASP.NET 2.0 as Grid Layout like in previous version

2 Answers   Citrix, TCS,


When you are running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

0 Answers   BirlaSoft,


What happens if an ASP.NET server control with event-handling routines is missing from its definition?

0 Answers   MindCracker,


Suppose you want an asp.net function (client side) executed on the mouseover event of a button. Where do you add an event handler?

0 Answers  


What is the Difference between user and server controls?

5 Answers  


What is the difference between “Web.config” and “Machine.Config”?

0 Answers  


Categories