Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display & validate Phone number


  • kechweb
    Participant

    @kechweb

    Hi,
    I’m using last version of buddypress with profile fields, I have two issues :
    1) i get in profil page phone as html not text like that :
    Phone <a href="tel://06666666669&quot; rel="nofollow">0666666666</a>
    2) how can i validate phone number in registration page? i used jQuery to do that but does not work, this is my code jQuery:

    jQuery(document).ready(function(){
    
    //Code Starts
    function validatePhone(field_49) {
        var a = document.getElementById(field_49).value;
        var filter = /^[0-9-+]+$/;
    
        if (filter.test(a)) {
            return true;
        }
        else {
            return false;
        }
    }​
    //Code Ends
    
    //Code Starts
    jQuery('#field_49').blur(function(e) {
       if (validatePhone('field_49')) {
           $('#field_132').html('Valid');
           $('#field_132').css('color', 'green');
       }
       else {
          $('#field_132').html('Invalid');
          $('#field_132').css('color', 'red');
       }
    });
    //Code Ends
    
    });

    Thnak you

  • You must be logged in to reply to this topic.
Skip to toolbar