1. magnus.singer
  2. General
  3. Sunday, May 13 2018, 10:27 PM
Hello there,
I have a little problem: I have a url field where the user has to enter his Facebook Profile Link. This field has the placeholder 'facebook.com/'. The default behavior of a url field is to add only 'http://' when it's necessary, but I want that it adds 'https://facebook.com/' when it's necessary. Is this possible and if it is, how can I do this? Big thanks in advance,
Magnus
admin Accepted Answer
Admin
Hi,
sorry for late reply, you can do it with a javascript code, but to help you better I need some other information.

For example if a user add something like http://www.google.it then you will have https://facebook.com/www.google.it :o
  1. more than a month ago
  2. General
  3. # 1
magnus.singer Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
sorry but I does not understood.

if I just enter google.com it adds the http://, but if I enter https://google.com, it does nothing
It is already so.
Is it possible to optimize the default behavior or do I need js?
what kind of optimizations are you thinking?
  1. more than a month ago
  2. General
  3. # 3
magnus.singer Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 4
admin Accepted Answer
Admin
Hi,
try to add following Javascript code to your template:
jQuery(document).ready(function($){
$('input[type="url"]').unbind('blur').blur(function(){
var value=$(this).val();
if(value!='' && value.indexOf('http://')<0 && value.indexOf('https://')<0) $(this).val('https://facebook.com/'+value);
});
});
  1. more than a month ago
  2. General
  3. # 5
magnus.singer Accepted Answer
Pro
Thank you very much now it works! Great support and even greater products, keep on going like that!
Greetings,
Magnus
  1. more than a month ago
  2. General
  3. # 6
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.