SitePoint Sponsor

User Tag List

Page 4 of 5 FirstFirst 12345 LastLast
Results 76 to 100 of 120
  1. #76
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    username should not be blank
    Close, I want you to show just one line. Not 5, not 10 lines of code, just one (1) (pronounced wun) line.

    There's a reason for this.

    One. Can you do it?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #77
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think it must be this

    if (!checkName(form) || !checkEmail(form) || !validatePwd(form) || !validPhone(form))
    {
    return false;
    }

  3. #78
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    i think it must be this
    No. You had the right section of code before. All I want from you is for you to find only one line where the username is being checked.

    Are you capable of doing this?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #79
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what about this one
    <form action="" method="post" name="form" onsubmit="return validate()">
    User Name : <input type="text" name="realname" size="19">

  5. #80
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    what about this one
    <form action="" method="post" name="form" onsubmit="return validate()">
    User Name : <input type="text" name="realname" size="19">
    Nope. I might just have to give up, conceding defeat at the idea of helping you to solve your own problem yourself.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #81
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is that correct in using a form in checkname function where user is accepting alphabets,numbers and special characters...
    i am having doubt there only

  7. #82
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have an individual function it is working perfectly

    <html>
    <head>
    <title>Validate Username</title>
    <script type="text/javascript">
    function validateUsername(textbox)
    {
    var sUsername = textbox.value;
    var oRE = /^[\w\d-.]{4,}$/g;
    var isCorrectFormat = oRE.test(sUsername);
    if (!isCorrectFormat)
    {
    alert("Incorrect format.");
    textbox.select();
    textbox.focus();
    return false;
    }
    alert("Correct format");
    return true;
    }
    </script>
    </head>
    <body>
    <input type="text" id="txtUsername" size="30" maxlength="20" />&nbsp;<input type="button"
    value="Validate" onclick="validateUsername(document.getElementById('txtUsername'));" />
    </body>
    </html>

  8. #83
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    i have an individual function it is working perfectly
    Have you tried usernames that are supposed to fail?

    ra.vi-95.1 should fail, but with your individual function it passes.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #84
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ya i too verified it is passing for all 3 special characters

  10. #85
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    ya i too verified it is passing for all 3 special characters
    Let me reiterate this. Earlier you were saying that you need it to not allow more than one special character at time. Right?

    It seems with that code that a username of ra.vi-95.1 will be considered to be valid, when you seem to require that it's not.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #86
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ya i want to accept only one special character out of .,_ and-

  12. #87
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    ya i want to accept only one special character out of .,_ and-
    Right, so take it back to the person who did it for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #88
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by changing only that regular expression i can do it know

  14. #89
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think it is very complicated to write a code for that right

  15. #90
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    i think it is very complicated to write a code for that right
    It is quite straight forward, one which we covered in post #54
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  16. #91
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    even i have checked that expression what we discovered in post #54
    which is /^[a-z0-9]+[_.-][a-z0-9]+$/
    with only single function also it is showing error as we give valid also it is alerting as invalid.

  17. #92
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    even i have checked that expression what we discovered in post #54
    which is /^[a-z0-9]+[_.-][a-z0-9]+$/
    with only single function also it is showing error as we give valid also it is alerting as invalid.
    It seems to work for me, so show us the scripting code you are using that has the problems.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  18. #93
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    below is the code for verifying only username

    <html>
    <head>
    <title> Validate Username</title>
    <script type="text/javascript">
    function validateUsername(textbox)
    {
    var sUsername = textbox.value;
    var oRE = /^[a-z0-9]+[_.-][a-z0-9]+$/;
    var isCorrectFormat = oRE.test(sUsername);
    if (!isCorrectFormat)
    {
    alert("Incorrect format.");
    textbox.select();
    textbox.focus();
    return false;
    }
    alert("Correct format");
    return true;
    }
    </script>
    </head>
    <body>
    <input type="text" id="txtUsername" size="30" maxlength="20" />&nbsp;<input type="button"
    value="Validate" onclick="validateUsername(document.getElementById('txtUsername'));" />
    </body>
    </html>

  19. #94
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    What type of input are you seeing as an incorrect format with that? If it's an issue of length, add those conditions to the if statement.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  20. #95
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am giving valid input only but it is showing the message incorrect format.

  21. #96
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    i am giving valid input only but it is showing the message incorrect format.
    Again I ask, what input?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  22. #97
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i gave input as ravikumar

  23. #98
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    i gave input as ravikumar
    Aha! So now we find out that the separator is completely OPTIONAL!
    That throws a whole new cat in amongst the pidgins.

    Place a question mark just after the separator class, and that will be dealt with.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  24. #99
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ya because user may be interested whether to give or not that is completely dependent on him.
    if he gives also only one special character at any time should be accepted

  25. #100
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    ya because user may be interested whether to give or not that is completely dependent on him.
    if he gives also only one special character at any time should be accepted
    Right, so place a question mark just after the separator class, and that will be dealt with.
    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
  •