Trying to make a modal view for customfield links

Hi I am attempting to make a modal view for a customfield links

I edited the code located in /opt/rt5/share/html/Elements/ShowCustomFields
After editing the code still no changes show for the customfield links. Could someone help me out where i am going wrong. No changes are being reflected. Restarted the service cleanered the mason cache and got the same issue. Any help is greatly appreciated.
my $print_value = sub {
my ($cf, $value) = @_;
my $linked = $value->LinkValueTo;
if ( defined $linked && length $linked ) {
# my $linked = $m->interp->apply_escapes( $linked, ‘h’ );
# $m->out(’’);

   my $linked = $m->interp->apply_escapes( $linked, 'h' );
   $m->out('<a href="#myModal" data-target="#myModal" data-toggle="modal">');
   $m->out('<div class="modal fade" id="myModal" role="dialog"><div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header">');
   $m->out('<button type="button" class="close" data-dismiss="modal">&times;</button>');
   $m->out('</div><div class="modal-body">');
   $m->out('<div class="embed-responsive embed-responsive-16by9 z-depth-1-half">');
   $m->out('<iframe src="'. $linked .'" name="myFrame"></iframe></div></div>');
   $m->out('<div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div></div></div></div>');
 }

Does your custom field that you are testing with have a “linked to” value? The code seems to make a modal for me testing real quick

thanks for getting back to me. I am trying to use it to open an external link like https://www.google.com to open in the modal. After I made the changes it just shows the old functionality before the changes. What did you have to do to see the applied changes in the code ? Did you have to restart something ?

I see a modal open with a Fire fox message:

To protect your security, www.google.com will not allow Firefox to display the page if another site has embedded it. To see this page, you need to open it in a new window.

But it does look like it is working. I am not using Apache but instead the standalone rt-server to test

Clearing the mason cache and restarting Apache should be enough to have any code changes take effect

Hmmm I did that. with respect to restarting it. I will try again and see what happens. Thanks for the quick response.

Ok looks like the code worked now
I had create and copy the file to this new location /opt/rt5/local/html/Elements/ the file ShowCustomFields.
Cleared cache and restarted apache and it worked now. Thank you for your help :slight_smile:

Ok so even though it worked and using internal links. If i add 2 customfield links it is applying the same link to both custom fields even though the two custom fields have different links.

My guess is you are defining the modal twice with the same ID, ie myModal so both custom fields open the same modal