Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

form does not validate in my selection box

 
dela cruz juan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
dela cruz juan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic