+ Reply to Thread
Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 62

Thread: We demand an official technical support to hide the phone number !

  1. #31
    Hello Wei Hong,
    If you want only 1 phone field and you know exactly key I suggest you yo use my code because it is easier and faster:

    Code:
    Only registered members can view the code.
    Last edited by Viktor; May 3, 2018 at 04:26 AM.
    Viktor,
    Flynax technical department,
    Best wishes.

  2. #32
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    1,457
    sorry, I forgot to change selector for number type field, it should go like this:

    var phones = $('#df_field_<your_field_key> .value');
    Last edited by Rudi; May 3, 2018 at 04:00 AM.

  3. #33
    Dear Rudi and Viktor,

    Thank you both for your recommendations. So I combined two of your solutions and managed to make it works for number type field "beru_phone." But not what I was looking for. This is the code I had tried in listing_details.tpl page

    <script type="text/javascript">
    {literal}
    $(document).ready(function(){
    var phones = $('#df_field_beru_phone .value');

    $(phones).each(function(){

    var unformatted = $(this).text();
    $(this).text(unformatted.replace(/(.)(?=(\d{4})+$)/g,'$1-'));

    var phone = $(this);
    var default_value = phone.text();
    var chars_to_mask = default_value.length - 4;
    var mask_phone = Array(chars_to_mask + 1).join("*") + default_value.substring(chars_to_mask);

    phone.text(mask_phone).removeAttr('href').toggleCl ass('mask');
    phone.css('cursor', 'pointer');

    $(phone).filter('.mask').click(function(){
    $(this).text(default_value);
    $(this).attr('href', 'tel:' + default_value).toggleClass('mask');
    });

    });
    });
    {/literal}
    </script>
    User input in beru_phone and it show on detail page 123456789012. With code above it show *********012, but click on it it still show 123456789012.
    I'm looking to make it show as 1234-5678-9012. Also it doesn't need masked since this is public phone number on yellow page.

    So I tried to remove masked featured and hope it will change 123456789012 to 1234-5678-9012 with this code

    <script type="text/javascript">
    {literal}
    $(document).ready(function(){
    var phones = $('#df_field_beru_phone .value');

    $(phones).each(function(){

    var unformatted = $(this).text();
    $(this).text(unformatted.replace(/(.)(?=(\d{4})+$)/g,'$1-'));

    var phone = $(this);
    var default_value = phone.text();
    });
    });
    {/literal}
    </script>
    But nothing changed. (((
    On listing detail page still show 123456789012
    Hu hu hu (T_T)

  4. #34
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    1,457
    Actually, I provided necessary code below, check carefully, see my 3d post from the top

  5. #35
    Quote Originally Posted by Rudi View Post
    Actually, I provided necessary code below, check carefully, see my 3d post from the top
    Yes Rudi, I read your reply yesterday when you provided this code below:

    $(document).ready(function(){
    var phones = $('div[id*="your_field_key"] .value a');

    $(phones).each(function(){

    var unformatted = $(this).text();
    $(this).text(unformatted.replace(/(.)(?=(\d{4})+$)/g,'$1-'));


    var phone = $(this);
    var default_value = phone.text();
    var chars_to_mask = default_value.length - 4;
    var mask_phone = Array(chars_to_mask + 1).join("*") + default_value.substring(chars_to_mask);

    phone.text(mask_phone).removeAttr('href').toggleCl ass('mask');
    phone.css('cursor', 'pointer');

    $(phone).filter('.mask').click(function(){
    $(this).text(default_value);
    $(this).attr('href', 'tel:' + default_value).toggleClass('mask');
    });
    });
    });
    I guess the red part is what change 123456789012 to 1234-5678-9012? I added it in my last try, it doesn't change anything
    Or did you mean your reply a few hours ago?

    It only have the following correction
    sorry, I forgot to change selector for number type field, it should go like this:

    var phones = $('#df_field_<your_field_key> .value');

  6. #36
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    1,457
    I've corrected that post and now it should work properly, check it
    The reason is that the field was surrounded by spaces and I've added a code which trims them

  7. #37
    Quote Originally Posted by Rudi View Post
    I've corrected that post and now it should work properly, check it
    The reason is that the field was surrounded by spaces and I've added a code which trims them
    Yes Rudi, I just tried it again and it worked perfectly. Thank you very much

  8. #38
    Senior Member
    Join Date
    Aug 2014
    Posts
    127
    How is it when you have to create a new field? 'telephone' ?

  9. #39
    Senior Member
    Join Date
    Aug 2014
    Posts
    127
    How is it when you have to create a new field? 'telephone' ?

  10. #40
    Quote Originally Posted by Blackred View Post
    How is it when you have to create a new field? 'telephone' ?
    You can try changing ID to telephone. It should work

+ Reply to Thread