hyper-links

Use this board to ask questions or have discussions with other Genie users.
Post Reply
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

hyper-links

Post by dkmccammon »

Is there an easy way to have Genie recognize url and mailto links on the page, and turn them into a hyperlink? I have tried a few methods with javascript, but instead of changing the text in the middle of a string to a hyperlink it actually just changes it to "see below for example"
email.PNG
email.PNG (2.42 KiB) Viewed 1939 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: hyper-links

Post by Scott Klement »

Javascript coding is the right way to do it... I'm guessing you didn't code yours correctly... maybe if you provide the code, someone would be kind enough to look it over and offer pointers...
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: hyper-links

Post by dkmccammon »

var firstChar = "I";
var rowStart = 7;
var row = rowStart;
var rowEnd = 22;
var lastChar = "2";
var elemID;

var searchString;
var emailAddress = /([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;
var emails;

while (row < rowEnd) {
elemID = firstChar + "_" + row + "_" + lastChar;
searchString = (document.getElementById(elemID).value);
emails = searchString.match(emailAddress);
if (emails !== null) {
document.getElementById(elemID).value = searchString.replace(/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi,
"<a href='mailto:$1'>$1</a>");
}
row++;
}
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: hyper-links

Post by Scott Klement »

All this does is set a variable named "searchString", it does not change what is shown to the user.
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: hyper-links

Post by dkmccammon »

It changes what is on the screen from TYOUNG@NAICO.COM to <a href='mailto:TYOUNG@NAICO.COM'>TYOUNG@NAICO.COM</a>
but the screen is not recognizing the tags. I am a bit rusty with javascript, and have been googling other examples and this is how they did it as well. How should I change it?
Capture.PNG
Capture.PNG (69.51 KiB) Viewed 1929 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: hyper-links

Post by Scott Klement »

Oh, I see... you're changing the "value' property of the DOM element. Sorry, I missed that, and I'm not used to customers working directly with the DOM instead of using our APIs.

The issue, as I see it, is that you're doing this on text boxes (i.e. "input fields"). Since they are input fields, they can't show hyperlinks... HTML does not allow a hyperlink in the middle of an input field.

I was expecting this to be in output fields, so I'm very surprised. Do you guys usually use input fields for everything and then use DSPATR(PR) to protect them when you don't want users to change them? If so, it might not be posible to solve this -- since hyperlinks are output-only.
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: hyper-links

Post by dkmccammon »

If there is an API that can do this function that would be great too. These text fields may contain multiple email addresses and may contain multiple url's that we need to provide a clickable link for all of them. On the "green-screen " the users can click on the email address or the url and our default email system (lotus notes) will pop up with the email address auto populated. Or the url of course opens the url in the default browser the user has selected.

For this program/screen, if the current user is the one that made the note they have the ability to edit the notes. However, if they are not the one that created the original note they cannot modify only insert a new line "note". So the protection depends on the current user and the original user that created the note.

So for example in this screenshot that was provided, all of the lines (textboxes) above 06-21-17 are not allowed to be edited, but will contain the emails or url's that need to have the ability to click on and it go to the associated designation. The line that containes 06-21-17 and the lines below it are editable by me. I was not the original creator of this note and have not made any previous notes. I can however insert a new line (in this case here a new textbox) to add my own comments if something needs to be added in between the notes from previous users.

This screen also has the fold and unfold ability to it, and when folded or unfolded the links need to remain available for the user to click on. At first I tried to simply put all of the data in a subfile, however, when you unfold the page the odd rows have only one column whereas the even row have 2 columns. I could not figure a way around making the subfile option work for this scenario. I left the fields how Genie rendered them without any edits because I was able to handle the fold and unfolding of the page as needed. Also depending on what the comment is in the note depends on what color the text will be. The textboxes that have a blue background, with exception to the textbox that I am trying to display a clickable link in, are textboxes that cannot be edited by me, whereas the ones that are white, again with exception to the textbox that I am trying to display a clickable link in, are textboxes that I have the ability to add content and update.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: hyper-links

Post by Scott Klement »

Unfortunately, you are out of luck. Unless you can change these to be output fields, that is. It's not possible to put a hyperlink inside an input field in HTML.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests