permaculture playing cards*
The moose likes HTML, CSS and JavaScript and the fly likes how to make visible 2 combo boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to make visible 2 combo boxes" Watch "how to make visible 2 combo boxes" New topic
Author

how to make visible 2 combo boxes

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
in my form...i had 2 combo boxes....if i click one combo box second combo box should be disabled that im doing....its working fine...but my problem is if i want to select both combo boxes how to do...i tried..but not getting any idea...here is my code...


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's almost impossible to read. Please move your JavaScript out of the tags and into methods, and refactor it as you do.

Your requirements seem to be contradictory: first you say you want to disable one of them, then you say you want both enabled. Can you be more precise in your requirements?
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
as already posted...in my form...sometimes i need to select 1st combo box and 2nd should be disabled...and sometimes both combo boxes should be taken...here is modifed code



multiLow.js



multiValid()

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

And what behavior are you seeing now, compared to what you want to have happen?

If you need to have both boxes selectable it seems weird that one checkbox would control the other checkbox, no? I mean, it's *your* code that's doing the disabling: you click one checkbox, the other one is disabled. Stop disabling the checkboxes if you need both checkboxes always available.
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
ok..that i had done it is working...is it not possible what i need or not...if i m clicking one check box its working by removing disable....
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure what you just said; is it doing what you need now?
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
1) if i click checkbox Low Balance and the other checkbox Validity becomes disabled...this i need so i got it...vice-versa
2) if i click checkbox Low Balance and the other checkbox Validity becomes enabled...


i need point 1 and 2 should be taken in my JavaScript....can you suggest me how to implement both the points..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60767
    
  65

HtmlHasNoComboBox


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Let me see if I understand what you want:

If the first checkbox is checked, Validity is disabled.
If it's unchecked, Validity is enabled.

Is this correct?
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi good morning,
what David is right....can you tell me how to implement it...i'll do it in my form...

thanks,
madhu.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please post your current code, and describe the behavior you're seeing versus what you want to see.
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
here is my code..

login.jsp



login.js



as i posted previously...im point (1)....
and coming to pint (2)......in the above code..if i make enable then both my points are working..

my doubt is i need to implement 2 times my code ....or what..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

...

If the requirements are based on the checked status of a single checkbox, why does the second checkbox go and disable the first one?

I don't understand why you're having a problem with this: you know what your requirements are (we *think* we do, but I'm not sure), you know how to enable and disable checkboxes and select boxes, and you know under what circumstances you need them to be disabled.

Right now, your code:

1) On entry, both checkboxes and selects are enabled.
2) If #low is checked, #valid/#mvalid are disabled.
3) If #low is unchecked, #valid/#mvalid are enabled.
4) If #valid is checked, #low/#lowbal are disabled.
5) If #valid is unchecked, #low/#lowbal are enabled.

What about that is different than what you need to have happen? If you only care about the checked status of #low, why do you still enforce 4) and 5) from my list above? If you *do* care about 4) and 5), why didn't you say that when I asked if my interpretation of your requirements was correct?

Don't just tell me to refer to your previous answers--if there was no confusion, I wouldn't be asking you to explain it again. You can't expect us to read your mind and understand your requirements without explicitly stating your requirements in a way we can understand.
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
what ever you posted is right....

1) if 'low' selected------'valid' and 'mvalid' gets disabled and vice-versa....

this i had done....

2) if i want to select both 'low' and 'valid' that i had done...

3) if i had selected 'low' and im not disabling...'valid' and 'mvalid'..... and i had selected only 'low' then im getting 'low' values with 'valid' values also...but i dont need that...

here the way im getting my output..



the '----Select Options'---- is from 'mvalid' combobox...

but i need as



this is what im facing problem in my output xml file...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Output XML? The problem is with creating an output XML file?!

How are you creating the output XML file?
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
by using Dom Parser..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617



How did you expect anyone to help you with an XML output file if all you've been talking about is JavaScript and HTML?

How about posting the code for what you're *actually* having problems with?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to make visible 2 combo boxes
 
Similar Threads
how to disable if one or more check boxes selected
enable/disable textbox
problem in getting combo box values
problem in output format
Enable the one drop down at a time