Changeset 25214 for extensions/GuestBook


Ignore:
Timestamp:
Oct 29, 2013, 5:22:41 PM (10 years ago)
Author:
mistic100
Message:

change url regex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GuestBook/template/guestbook.tpl

    r20181 r25214  
    22{combine_script id="livevalidation" load="footer" path=$GUESTBOOK_PATH|@cat:"template/livevalidation.min.js"}
    33
    4 {footer_script require='livevalidation'}
     4{footer_script require='jquery,livevalidation'}
    55{if !$comment_add.IS_LOGGED}
    66var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
     
    1515
    1616var website = new LiveValidation('website', {ldelim} onlyOnSubmit: true });
    17 website.add(Validate.Format, {ldelim} pattern: /^https?:\/\/(-\.)?([^\s\/?\.#-]+\.?)+(\/[^\s]*)?$/i,
     17website.add(Validate.Format, {ldelim} pattern: /^https?:\/\/[^\s\/$.?#].[^\s]*$/i,
    1818  failureMessage: "{'invalid website address'|@translate}"});
    1919
     
    2828    jQuery("#addComment").slideDown("slow");
    2929  });
     30});
     31
     32jQuery("#website").on('blur', function() {
     33  var val = $(this).val();
     34  if (val.substr(0, 4) != 'http') {
     35    $(this).val('http://'+ val);
     36  }
    3037});
    3138{/footer_script}
Note: See TracChangeset for help on using the changeset viewer.