Hyperlink control, how to set parameters via code

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
AlexStenAlexSten
Posts: 31
Joined: Fri Apr 07, 2017

31 Aug 2017

hello,
I'd need to use a hyperlink control on a form and set the url (Href...) via javascript, based on the ID of the current item.
2017-08-31 12_25_11-Forms Designer - Internet Explorer.png
2017-08-31 12_25_11-Forms Designer - Internet Explorer.png (43.83 KiB) Viewed 1862 times
Can you help me to understand, how to modify the hyperlink control settings please?

thank you
ciao,
Ale Stendardo

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

31 Aug 2017

Hello, Alex!
You can use JQuery to change href attribute of the link control. Give the link a class and then use this code:

Code: Select all

$(".myURL").attr("href", "http://www.website.com/");
Cheers

User avatar
AlexStenAlexSten
Posts: 31
Joined: Fri Apr 07, 2017

31 Aug 2017

thanks a lot Nikita!
will try it immediately.

Cheers
ciao,
Ale Stendardo

Cloud.Ed
Posts: 40
Joined: Fri Dec 04, 2015

11 Dec 2017

Can you set href attribute to open in a new tab?

Thanks!

Cloud.Ed
Posts: 40
Joined: Fri Dec 04, 2015

11 Dec 2017

I found the answer, just the correct attribute like

$(".myURL").attr("target", "_blank");

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

12 Dec 2017

Hello, Cloud.Ed!
Okay, great to hear that! Yes, it's a simple JQuery command to change target attribute and it should work rather straight-forward.
If you do encounter any issues in the future or have any questions - please, let us know.
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests