2 drop down box and 1 text field connected.
The text field should be an optional; meaning, if first 2 drop down is selected, my page will still proceed even text field is empty.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
2 drop down box and 1 text field connected.
The text field should be an optional; meaning, if first 2 drop down is selected, my page will still proceed even text field is empty.
Last edited by bajeanius; July 24th, 2012 at 04:06 AM.
I might be the only one, but honestly don't have a clue what you are asking. You are better off actually asking a question and describing the problem. Better yet, read the link in my signature entitled "Getting Help"
Thread moved from http://www.javaprogrammingforums.com...introductions/
If you want to check whether something is selected in the combobox you can use:
if(combobox1.getSelectedIndex() == -1) { // Nothing has been selected in the combo box }
Check out my site -> tssolutions.net16.net
Okay, I need to create a webpage for querying data. Page will have a table for user to select their choice, let's say 2 drop down box then 1 optional textbox.
Name 2 drop down box as A and B, and textbox as C.
When user select nothing, A should be enabled, B and C should be disabled.
When user select something in A, B response and show only certain or corresponding choices while C is still disabled.
When user has selected something in A and B, C will then be enabled, but it is still a optional textbox, meaning user may not need to enter anything but page will still proceed to the next.
But if C is entered with a number, program should grab that number and work with that then show the result at the next page.
Is this understand-able? =/ Lol. Well, there's a picture below, I hope you will understand it better then.
Anyway, thanks for replying..
Capture.JPG
You will have to somehow determine when an item in A has been selected.
Then determine which item it was in A.
Based on that, decide what to throw into B.
Then follow your basic shampoo instructions.
bejeanius,
the combo boxes should be attached to an actionListener like this
is that what you mind?public class Boxes extends JDialog implements ActionListener { ... box1 = new JComboBox(("1!2!3!4").split("!")); box1.addActionListener(this); ... box2 = new JComboBox(("A!B!C!D!E").split("!")); box2.addActionListener(this); ... // disable box2 and texfield tf ... public void actionPerformed(ActionEvent e) { String ev = e.toString(); if (ev.charAt(0) >= '9'){ //enable box2 } else { // enable textfield tf } } ...
Bajeanius
Sorry for trouble finger with your nick and with the post button
The term ev.charAt(0) is incorrect. It's as following
public void actionPerformed(ActionEvent e) { String ev = e.toString(); char ch = ev.charAt(ev.indexOf("selectedItemReminder=")+22); if (ch >= '9'){ //enable box2 } else { // enable textfield tf }