![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: May 2008
Posts: 23
OS: XP
|
Conditional Form Requirements (ASP.NET)
Hey guys,
I'm trying to make a form that has a conditional form requirement, but I'll dumb it down for this purpose: The form would ask a question like so: Are you cool? This would be followed by two radio buttons: Yes, and No. If the user selects "Yes", I want the next text box to have to be filled out. If the user selects "No", they shouldn't need to fill out the next box. Any ideas? I've looked into Compare validators and such, but have not found a solution. It shouldn't be too hard to figure out, the trick is doing it on the client side though, as I don't want to use Ajax to load any part of the page again. Thanks! |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 905
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Conditional Form Requirements (ASP.NET)
Javascript. Let me know if this makes any sense to you.
Code:
<script type="text/javascript">
<!--
if (radioYes.value="selected") {
if (textboxIfCool.value="") {
window.alert("ERROR: You must fill in such and such textbox."
}
}
//-->
</script>
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: May 2008
Posts: 23
OS: XP
|
Re: Conditional Form Requirements (ASP.NET)
thats great, but honestly the only problem is that I don't want a popup. The rest of my errors throw a red "*" next to the item, which I'm sure I can put a label and change the text with javascript as well?
You'll have to excuse my lack of knowledge with javascript, but if this is possible, let me know! Thank you! |
|
|
|
|
|
#4 (permalink) |
|
God (TSF Enthusiast)
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 905
OS: Ubuntu 9.10 [Karmic Koala]
|
Re: Conditional Form Requirements (ASP.NET)
change
Code:
window.alert("ERROR: You must fill in such and such textbox."
Code:
document.write(getElementById(pBeforeRadioYes.innerText="*"));
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email. |
|
|
|
![]() |
| Thread Tools | |
|
|