Results 1 to 8 of 8

Thread: Form Validation in Table

  1. #1
    Join Date
    Jul 2010

    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?

    Here is the JavaScript form validator

    and here is the form with the calls to the script to validate:

  2. #2
    Join Date
    May 2006
    Somewhere behind your screen
    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
    signature under construction

  3. #3
    Join Date
    Jul 2010
    So... How should I do it?

  4. #4
    Join Date
    May 2006
    Somewhere behind your screen
    Quote Originally Posted by macboy16 View Post
    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

    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
    signature under construction

  5. #5
    Join Date
    Jul 2010
    How do I do that? I'm sorry, I don't know how to do anything in JS.

  6. #6
    Join Date
    Jan 2009
    do you know any other scripting code or 'programming' code ie C, C#, C++, PHP, Java? if not you will have to learn javascript before you can write it. If you do know one of the others, many of the statements are the same it is just learning a little new syntax and implementing it correctly. that's basically what i did; i knew some C++ and just used my knowledge of that to learn javascript fairly quickly.

    to learn javascript start here.

    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.

  7. #7
    Join Date
    May 2006
    Somewhere behind your screen
    Quote Originally Posted by spotted zebra View Post
    ... 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
    signature under construction

  8. #8
    Join Date
    Jan 2009
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10712 seconds
  • Memory Usage 2,916KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates