SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript- anyone who can do me a QUICK favor?

    hey on http://www.4netdesign.com/contact.html i have a form (not yet active) and it's validating everything. i used dreamweaver for that, and it inserted some unnecessary javascript code as well... the parts about the numbers and stuff (one of the options for validating types). can someone just give me a quick coding of the page without the extras? the only validating types i'm using are email address and "anything". thanks

    http://www.4netdesign.com/contact.html

  2. #2
    Sports Publisher mjames's Avatar
    Join Date
    Jan 2000
    Location
    Charlotte, NC
    Posts
    5,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean a quick coding without the extras? Try re-explaining your problem if it still exists and then perhaps someone will help you.

  3. #3
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dreamweaver creates javascript code that automatically adds validation for "anythign", "email", "numbers", and "numbers between the ones provided". however, if you don't use all of those validations, the code still remains in the javascipt. i need someone to take out the code that doesn't apply to my page.

  4. #4
    SitePoint Member
    Join Date
    Sep 2001
    Location
    Dallas, Texas
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    You can give this a shot...

    If I understood you right, this should do the trick, just replace the MM_validateForm() function with this one:

    Code:
    function MM_validateForm() { //v3.0
      var i;
      var p;
      var q;
      var nm;
      var test;
      var num;
      var min;
      var max;
      var errors='';
      var args=MM_validateForm.arguments;
      for (i=0; i<(args.length-2); i+=3) {
        test=args[i+2];
        val=MM_findObj(args[i]);
        if (val) {
          nm=val.name;
          if ((val=val.value)!="") {
            if (test.indexOf('isEmail')!=-1) {
          	  p=val.indexOf('@');
               if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
            }
          } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
        }
      } if (errors) alert('The following error(s) occurred:\n'+errors);
      document.MM_returnValue = (errors == '');
    }
    I made it more readable.
    signature


Bookmarks

Posting Permissions

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