Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Strange problem with validation

    I was given a project this week to find a way to validate a form that uses utf-8 number system to name alot of the obj in the form. From what i understand we cant change anything on the database so we are stuck using those numbers. But Javascript wont let me use a name with a digit in the beginning.

    Does anyone know another way to validate a form instead of using ID or name?

    I understand that there is something called validation by element but im not sure i understand what that is.

    Thank you for reading through.
    Brian

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Are you asking how to select a form element without using an ID? You could do it based on the element’s position in the page structure; for example, document.getElementsByTagName("input")[4] would select the fifth occurance of an input element in the document.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so say i have 3 input boxes and then 2 drop down objects would that be then be document.getElementsByTagName("input")[4] or would just the input boxes be in the array??

    Im sorry i cant seem to get out what i mean clearly.

    but thanks for the help.
    Brian

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    getElementsByTagName() is an array of all elements in the document matching the provided name; the elements are in the array in the order in which they appear the document. getElementsbyTagName("input") would not include drop-down objects; you would need getElementsByTagName("select") for that.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •