SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2010
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help with validity script

    im really stuck on this form validation so far i was only able to get it to check for the email or password but not if there both blank all i got is

    function blankfields(){
    if(screenname.hiddeninput.length == 0){
    alert("document.screenname.hiddeninput")
    screenname.hiddeninput.select();
    screenname.hiddeninput.focus();
    return false;

    }

    }
    any help will be appreciated

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by aleronl16x View Post
    im really stuck on this form validation so far i was only able to get it to check for the email or password but not if there both blank all i got is

    function blankfields(){
    if(screenname.hiddeninput.length == 0){
    alert("document.screenname.hiddeninput")
    screenname.hiddeninput.select();
    screenname.hiddeninput.focus();
    return false;

    }

    }
    any help will be appreciated
    Start off by assigning isValid to true at the start of the function.
    Then perform your tests, changing isValid to false if it doesn't pass your test.
    Finally return isValid.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •