SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot akohl's Avatar
    Join Date
    May 2001
    Location
    Israel
    Posts
    184
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    using quote in bad character validation string

    I've got the following form validation script. How can I include the quote marks as
    a bad character?
    I tried:
    var bad_email_chars="/!#$%&*+^ ()_-=|~`?;:,'"""
    It didn't help.

    if(form1.elements(i).name=="text_website")
    {
    var bad_email_chars="/!#$%&*+^ ()_-=|~`?;:,'"
    var h,j
    for(h=0;h<bad_email_chars.length;h++)
    {
    for(j=0;j<input_str.length;j++)
    {
    if(bad_email_chars.charAt(h)==input_str.charAt(j))
    {
    alert("you have atleast one bad character in you website address. You may not submit this form until you correct this.")
    window.event.returnValue=false
    form1.elements(i).focus();
    }
    }
    }
    }

    Also, How do I format with indentations and as non wraping text the messages I send to this forum?

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't know if this is the answer to your problem but have you tried 'escaping' the quotation marks? I know that whenever I need to output quotation marks client side I have to escape them with backslashes:

    var bad_email_chars="/!#$%&*+^ ()_-=|~`?;:,\'\"\"";

  3. #3
    SitePoint Zealot akohl's Avatar
    Join Date
    May 2001
    Location
    Israel
    Posts
    184
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    thanks

    That seems like something I was shown once and forgot.
    I think its just what I need.
    Thanks.

    Andy


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
  •