Javascript Validate a comma exists in a field

Discussion in 'JavaScript' started by crm_user, May 15, 2008.

  1. #1
    This is pretty simple (manager thinking, not me ) but I need to be able to validate that a field has a comma, that's it, that simple. How would I set this up?
     
    crm_user, May 15, 2008 IP
  2. chenyaniv

    chenyaniv Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    it shuold go somthing like that:
    
    function check_comma(str)
    {
    if(str.indexof(",")==-1)
    alert("insert a comma");
    }
    
    Code (markup):
     
    chenyaniv, May 15, 2008 IP