Hi All, we would appreciate any help on this?
We have a lookup table containing a list of sites and urls. We wish to put a clickable link inside a custom css field. We understand that since the value is retuned during editing of the form then JavaScript is required to trigger on change.
BP_site = The list of sites
BP_URL = the url for the site
Four questions
1. Our code does not work, can anyone help us?
2. The console.log does not create any log entries in the F12 developer tools?
3. If the variable clickable link was being created and set, how would it be accessed from the custom CSS since there is not as token to select in the list?
4. We tried doing the same in the modern designer but are getting an error The error "ReferenceError: $ is not defined". Do we need to include a reference to the jQuery library before our JavaScript code? How would that look inside Laserfiche
Apologies in advance for any rookie errors in this.
code for the classic designer:
$(document).ready(function() { $('#q1').on('change', 'input', function() { var clickablelink = $('#q2').val(); if (clickablelink.length !== 0) { $('#q2').attr('href', $('#q2').attr('href')); console.log('#q1'); console.log('#q2'); console.log(clickablelink); } }); });
code for the modern designer
$(document).ready(function() { $('.BP_site').on('change', 'input', function() { var clickablelink = $('.BP_URL').val(); if (clickablelink.length !== 0) { $('.BP_URL').attr('href', $('.BP_URL input').val()); } console.log($('.BP_site').val()); console.log($('.BP_URL').val()); console.log(clickablelink); }); });