Copy link to clipboard
Copied
HI, i've created a web app that contains a website url in a field type that is text(hyperlink), this automatically creates a link when i pull that field into a page,
Is there a way to make these links open in a new window or target?
My only thought is I have to change the field type to plain text(string), and then cretae a urlwith target, and pullthe value into that code?
If so, if I already ahve existing web app items, is the data safe when you switch a field's type?
Copy link to clipboard
Copied
I found an external script to make sure off-site links open in a new window.
http://www.dynamicdrive.com/dynamicindex8/newwindow2.htm
Turns out trying to change a web app field's field type after its created is not allowed. so with 2500 web app items, i really don;t want to erase that field and reinsert a new field for holding a website link, B/c if i set to text(string) so that it returns the value in plain text, and i can populate a static hyperlink on a page.
Hopefully BC will address this internally, maybe we could simply add a extra modifier like "_blank" to any text(hyperlink) field?
{tag_fieldname} to {tag_fieldname_blank}
Copy link to clipboard
Copied
Hi Richard,
You are correct. Once the database field has been created its type can not be changed. You would need to export the items, delete the field and recreate it as a Text(String) field type, then wrap its tag inside the href and add target="_blank" to it. Then you'd have to re-import the web app items.
Since it is a lot of work you may as well use some simple JavaScript to add that target attribute to your links.
As for {tag_fieldname_blank} I think thats a great suggestion and I'll add it as a feature request to our ticketting system.
Cheers,
Mario
Copy link to clipboard
Copied
That would be a great addition, unrelated but whats the easiest way to loginto the new forums to reply, I had to loginat the very top right, but then go back to my email to cliock this link to get me back to the thread as logged in, seems a lot to just post a reply
Copy link to clipboard
Copied
Not sure why that is, Rich... This forum keeps me logged in all the time. I haven't had to log in since I started using it. I'm on Mac in latest Chrome.
Cheers,
-mario
Copy link to clipboard
Copied
Make sure you remember when you logged in. Ipad, Mac and PC different browsers it keeps me logged in.
Copy link to clipboard
Copied
You can try this:
//using jquery:
$(document).ready(function(){
$('#link_other a').attr('target', '_blank');
});
// not using jquery
window.onload = function(){
var anchors = document.getElementById('link_other').getElementsByTagName('a');
for (var i=0; i<anchors.length; i++){
anchors[i].setAttribute('target', '_blank');
}
}