• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript Dynamic Dropdown Box validation

 
Prasath Arjunan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need a JavaScript Validation for Dynamic Drop Down Box when clicking the submit button. But the drop down box attribute name and id should be same for all drop down boxes. I tried below code but its not succeeded, its work well when there are multiple drop down box but its does not work when there is only one drop down box. Please help me for find out this problem or give me any suggestion without changing of attribute name and id of drop down box.




Thanks in Advance,

Prasath Arjunan.
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Id should be unique, why would you want to have the same id for different elements?
 
Prasath Arjunan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it should not be unique...both id and name, because i cant generate unique id.
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, really, it should be unique, other thing is that you don't want to make it unique, but imagine you are going to travel by plane and another guy has the same ticket number that you have, what happends?

A workarround if you want to do it this way is use the getElementsByTagName('select') but I would try to have unique ids as I have told you before.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your ids are not unique, your HTML is invalid and you will have nothing but endless troubles.

Your id values must be unique!
 
Prasath Arjunan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks a lot... I have resolved this solution with the getElementsByTagName('select')
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic