hide url in field, only show visit button

Hi There,

I have a filed with an ID called “bpv_code”. the ID is filled in by the user. The ID is also a parameter to an external site, so i made a custom field called ‘SBB-link’ and put this code in the ‘onload’ event

{SBB-link}=“https://zoeken-mijn.s-bb.nl/Home/Details?LeerbedrijfId={bpv_code}”;

make a onchange event to save so that the “SBB-link” field is filled. so far so good.

Now i have a working link and a button that the user can use to check the external site. But… i wan’t to hide the utl link and only show the button and that i can not do form some reason.

two solutions would be fine.

  1. the field “bpv_code” has his own button to the external link, don’t no how to do that
  2. the “SBB-link” field has a hidden url link and only a button, don’t no how to do that :wink:

any ideas or suggestion to a nice solution?

I’ve had exactly the same problem/idea, but there’s actually quite an easy fix. Assuming that; you’re using a form application and have a little basic knowledge of PHP and CSS.

Create a new “label” field named SBB-link, then go to Events > onLoadRecord


{SBB-link} = '<a href="https://zoeken-mijn.s-bb.nl/Home/Details?LeerbedrijfId='.{bpv_code}.'" target="_blank" class="someClassHere"><img src="www.url-to-something.com" class="someClassHere"></a>';

If you want to add some extra CCS, add the following under Events > onLoad


?><style>
.someClass { color: black;
text-decoration: none; 
 }
</style><?php

Now, if you want to go extra fancy, try adding FontAwesome to the script under Events > onLoad


?>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<?php

And replace the tag in Events > onLoadRecord with an tag, as can be found on the Font Awesome website.


{SBB-link} = '<a href="https://zoeken-mijn.s-bb.nl/Home/Details?LeerbedrijfId='.{bpv_code}.'" target="_blank" class="someClassHere"><i class="fas fa-link"></i></a>';

He Vatalogic, that’s also an option! i’ll give it a try and let you know. thx

Let me know if you’re stuck, I’ve spend countless hours figuring out these kind of workarounds and extending the Scriptcase system.

a a label field. that did the trick. Any suggestion to use a bootstrap button (i use theme everywhere) with this trick… can’t quite figure it out.
{SBB-link}=’<button type=“button” class="btn btn-outline-success ">CHECK</button>’;

This code works in a grid but in the form onloadrecord it gives an error

{SSB-link} = ‘<a class=“btn btn-outline-info” href=“https://zoeken-mijn.s-bb.nl/Home/Details?LeerbedrijfId=’.{bpv_code}.’” target="_blank" role=“button”>SBB CHECK</a>’;

Try something like below to see if the variable you want to use is available; if that isn’t the problem then it’s a syntax issue with the rest of the line. I’m still not really sure on how Scriptcase handles it’s internal curly-bracket variables.


{SSB-link} = {bpv_code};

the code works! it’s the handling of bootstrap in a form… if i use a link button internal to a scriptcase app it’s ok. the same button with the external url doesn’t do the trick. and that’s strange because the use of the fontawsome line works. ( all my buttons are bootstrap, so the use of any other button is not consistent)

I haven’t worked a lot with bootstrap, but I assume it’s a JS driven thing. Some JS things don’t work for me neither, unless I wrap them in something that’ll wait until the DOM has loaded. Also, be sure to clear your browser cache - in Chrome for example that means reloading with CMD+SHIFT+R instead of CMD+R. Otherwise it may (or may not) use a cached version of certain JS/CSS functionality.


?>
<script>
$( document ).ready(function() {
     // Your JS stuff goes here
});
</script>
<?php 

i’ll give it a try… thanks so much for the solution