![]() |
[Urgently] Form Validation (If & then)!
Hi guys, first i hope u will understand me...
So i want to make a javascript to be shown if somebody chooses option A to show the javascripts for the A1,A2,A3 and if they choose B to show javascripts for the B1,B2,B3. So the A and B it will firstly asked as options from a <select> tag eg. Code:
<select name="AorB" >Code:
<SCRIPT language=JavaScript> |
Despite the similar sounding names, Java is not the same as Javascript.
Moving from Java forum to Javascript forum. |
Ok sorry Fou-Lu, ...btw i hope anybody understood ..... i meant if We select OPTION A there will be shown some Input-s ....and javascript will ask only for the shown input-s so it means OPTION A input-s ... but not to ask for OPTION B input-s too even that they're not shown cause we didnt select OPTION B ... i hope i explained a little for you.
|
Well, for starters, you have to use the ONCHANGE event of the <select> to change *WHAT* is displayed. That is, to show one or the other set of questions/fields.
Have you done that? You don't even show what those other questions/fields are in your post. |
Quote:
Code:
<select name="AorB" >Then, once we choose Option B there down will be shown few more input-s (like i said above: B1,B2,B3) , and i want same thing to happen if we choose Option A, so it will show DIFFERENT input-s (A1,A2,A3) , so essence is that i want this javascript to ask for input-s that are shown after choosing an option A or B , but not ask for ALL input-s , only the once that will be shown after selecting an option. |
Quote:
Don't make us create a dummy HTML page for you just to demonstrate this simple code, only to find out that our dummy HTML isn't anything like what you wanted. Give us the HTML with *ALL* fields (A1,A2,A3 as well as B1,B2,B3) *FIRST* and then it's easier to show you how simple the code is. |
Quote:
use view-source to view what i included there, thank you so much , once again! |
fixed / thank you everyone!
|
Great!
I tried to go to your link, but it just gives a message saying the index page is missing. If you need more help, post a corrected link. Yes, posting links that show code like that is not only permissible but encourage. You should only get dinged if it was an obvious attempt at advertising or it linked to a site that had, shall we say, improper content. |
| All times are GMT +1. The time now is 08:13 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.