File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes form does not validate in my selection box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "form does not validate in my selection box " Watch "form does not validate in my selection box " New topic
Author

form does not validate in my selection box

dela cruz juan
Greenhorn

Joined: Nov 21, 2012
Posts: 13
Hi Java Guru's

Just want to ask some help on the below code, seems like when I try to select multiple items on the select topic 3 the form only validates a single item

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3943
    
  17

I think what you have to do to get all the items selected in the multi select list is to pass the select item itself to the method, then iterate over all the items, check to see if it is selected and if it is do what is appropriate.


Steve
dela cruz juan
Greenhorn

Joined: Nov 21, 2012
Posts: 13
Steve Luke wrote:I think what you have to do to get all the items selected in the multi select list is to pass the select item itself to the method, then iterate over all the items, check to see if it is selected and if it is do what is appropriate.


Hi,
can you help me with these actually I only copied this code from some sites and did some research on understanding the java as well, going to my problem, the code really validates on what I choose on the selection boxes, the only only thing is the last selection box :



when I choose multiple items it didn't validate all, only one.
you can also try it
<Math> - <basic_math> - <addition> +<2 items>
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3943
    
  17

Please don't add really long lines to your code tags, it breaks the format...

understanding the java as well

Nothing you posted is Java code. It is JavaScript code, which is a different programming language. It is important to understand that.

As mentioned, you have to pass the select object or the list of options in the Select. Then iterate over each option, check if it is selected, and if it is do the work. See this page on W3Schools for methods available on the Select object, and this page for those available on the Option objects.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: form does not validate in my selection box
 
Similar Threads
Problem in listBox scrolling in NS 4.7
forms[0].changes.value is null or not an object
Linked List equals method
To higlight the recent items getting displayed in JList
not redirecting to servlet page