Click here to Skip to main content
16,013,581 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to make textbox2 required(true) onchange of textbox1 in javascript?

Please let me know on this.
Posted
Comments
thatraja 17-Dec-11 0:34am    
Confusing little bit. Elaborate more.
Rajesh Anuhya 2-Jan-12 6:40am    
Not Clear.., can you elaborate it more...

The simplest solution would be to validate the form before you submit it.
Call a javascript method on submit of the form which will -
First check if the value of TextBox1 is empty or not. In case it has some value, it will check the value of second TextBox. If it is empty, an alert or error message will be fired.

You get the text in a TextBox in JavaScript using this syntax -
var TextBoxValue = document.getElementById("TextBoxID").value;

I will leave the rest part of writing code to you. Let me know if you have any issues.
Hope it helps!
 
Share this answer
 
XML
<input type=checkbox id=ch>

<script>

    document.getElementById("ch").checked = true;

</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900