Form Validation in Table
Hello everyone! I'm new to these forms and (very new to) JS. I hope someone can help.
What I am trying to do is have a form in a table validate in the same order as the tab order. The form is in a table with three columns. There are a few fields in each column below each other. They are not in separate cells. (Spacing issues when they are in their own cells.) Validation is working correctly, however when it is validating, it validates column by column, not by "row."
Can anyone help me get it to validate in the correct order?
and here is the form with the calls to the script to validate:
forms are usually validated using a loop which does some tests to the given form elements. usually such loops go through the form elements according to their indexes and no matter what html is used for visual positioning of these elements. making such loop to go through the form elements in another order may slower the script and i doubt this is a very good idea
So... How should I do it?
1. you create an array which elements are the given form elements (names or ids) ordering them as required
Originally Posted by macboy16
2. then you validate them using a loop which will go not through the standart form elements collection as by default but through this array
there may be several ways of doing this i suppose
How do I do that? I'm sorry, I don't know how to do anything in JS.
they even have the basis for a form validation there but it is not that great IMO. i found another one using google and slightly modified it to make it work how i wanted to.
and if you are going to be validating forms i imagine you are going to be submitting them to an email address or a data base in which case you should also learn php. PHP can also validate the form for you but it does it server side so it takes longer but is still a solid way to do so.
and one should use server-side validation no matter was the form validated with JS or not to prevent sql-injections or another malicious data because js-validation is not safe
Originally Posted by spotted zebra
yes i haven't progressed that far in my self teaching so i do not know all of the stipulations and uses of it yet. glad to know you can stop stuff like that though.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread