In a page there is dropdown list with the name of the
cities like Bangalore,Pune,Chennai,Other and a text box
that would enable the user to enter the name of the city if
other is selected. How to enable validation on the text box
if other is selected

Answer Posted / deepak

just write a javascript function like this
on button click or on onkeypress event of text box

function validate()
{
if(document.getelementbyid("ur dropdownlist").value=="other")
{
if(document.getelementbyid("ur textbox").value=="")
{
alert("please enter city name");
return false;
}

}

}

and call like this onkeypress='return validate()'

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Let's say I have an existing application written using vb6 and this application utilizes windows 2000 com+ transaction services. How would you approach migrating this application to.net?

501


Is there any limit for query string? Means what is the maximum size?

483


Give an example of cookie abuse.

593


What is the use of autowireup in asp.net?

553


What is the difference between globalization and localization?

487






Which is the parent class of the ASP.NET server control?

536


What are the asp.net security controls?

546


What are custom controls?

529


When we use cookie less session? Explain its working?

557


What is asp.net web pages?

526


What is the life cycle of web page?

521


What are the uses of list view control in Asp.net?

611


Can the dictionary object be created in client?s scope ?

1984


What is the file extension of web service?

551


What are the differences between primary foreign and unique keys?

512