codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  validating drop down  sumu at 06:47 on Tuesday, July 10, 2007
 

Hi

My requirement is that i hv a radio button fail.after selecting dat i hv to select the reason also using the dropdown list.if the reason is not selected an error should be thrown.how to accomplish this in java.can anyone pls help.

Thanks

  Re: validating drop down  mmarab at 09:45 on Tuesday, July 10, 2007
 

Hi Sumu,

there are many ways you could do this, some more difficult than others. I will list a couple of ideas, but depending on how your code has been written, they might not fit in.


1) You could set the first value in the combo box to be "none", then you could obtain the value from the combo box and check that the value is not equal to "none" i.e. if(!ComboValue.compareTo("none")) //something like that.
{
}
else
{
System.out.println.........please select reason....(whatever)
}

2)The other way you could do this, would be to have a boolean global variable called "reason"(this is a bad name) set to false. When the check box is then used, inside the combobox handler set "reason" to true, then you can check the status of "reason". But remember to set it back to false again.

With both of these examples i am assuming you have a JButton that you press after the fail radio button is pressed to submit the reason. These are both very simple examples. But they will both work.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: horizontal scroll bar for drop down list box
•  Wheel Project
•  TO SEND Text message or URL through Clickatell
•  Re: JTable
•  Unix command output displayed 0 in browser
•  Perl 5.6 PPM is not working
•  Re: Need Code
•  telnet to a system with username and password using perl
•  Re: validating drop down


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007