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
What is the postback property in asp.net?
What are session state modes? List some of the important session state modes of asp.net.
Why do we need master page in asp.net?
Explain the use of duration attribute of @outputcache page directive.
Where sessions are stored?
Describe session handling in a webfarm?
Why SessionID changes in every request in asp.net?
How is application management and maintenance improved in asp.net 2.0?
Is it right that ASP.NET Web API has replaced WCF?
Explain why datareader is useful?
Is web config mandatory?
What is difference between asp.net and asp.net mvc? : Asp.Net MVC
Explain model, view and controller represent in an mvc application? : asp.net mvc
Explain the concept of event bubbling in ASP.NET?
How do you hide the columns?