Adding an hyperlink or a button in a form
Posted by ninkasi - May 21 ’13 at 07:49
Hello,
I was wondering if there's a way to add an hyperlink or a button that redirect to an url in a form ?
Does anyone got any ideas ?
Thanx
-
DmitryAdminMember for: 10 years 11 months 19 days
You can add hyperlink or button with javascript. In the following example I'm adding a hyperlink 'Test' at the top of the form
$('#fd_form').prepend('<a href="http://test.org">Test</a>');
Put this script into JavaScript editor in Forms Designer.
-
ninkasiMemberMember for: 10 years 8 days
Thanks a lot for your answer.
And if I want to place it in a specific table or table cell, is there a way to achieve that ?
I guess I have to declare a div id at some point that the script will refer to, but I didn't find how to do that.
-
DmitryAdminMember for: 10 years 11 months 19 days
-
DmitryAdminMember for: 10 years 11 months 19 days
The message was removed by a forum moderator.
-
DmitryAdminMember for: 10 years 11 months 19 days
-
ninkasiMemberMember for: 10 years 8 days
Thanks again for your quick answer, I was on the right way but was mistaken # and . !
-
mgilbertMemberMember for: 9 years 11 months 12 days
Hi - I have tried to insert a link and am having trouble. When I add the js code [$('#fd_form').prepend('<a href="http://www.google.com">Google</a>');], save it, and open a new item form all I see is this text at the top of the form: <a href="http://www.google.com">Google</a>. What am I doing wrong? I am using SharePoint 2010 with IE9 - which I beleive is IE8 as SharePoinit 2010 converts to it. I ideally would like to have a link next to a field in a tab, but am starting with the basics. Any hep would be great. Thanks.
-
DmitryAdminMember for: 10 years 11 months 19 days
[#7]: Hello,
I have tried this code in all versions of IE and it seems it works correctly. I suppose you use an old version of Forms Designer. In version 1.x this code is not working. So, if you use Forms Designer 1.x try to open your form as web part page:
Then insert Content Editor Web Part and put your link with help of it.
-
mgilbertMemberMember for: 9 years 11 months 12 days
[#8]: You are right I do have the older form and have tried your solution and have not been able to get it to work. I inserted the content editor webpart on the new form page and added the js code with the opening and closing javascript tag like this <script type="text/javascript">$('#fd_form').prepend('<a href="http://www.google.com">Google</a>');</script> inside of the html markup, and still nothing. Any other ideas? Thanks!
-
DmitryAdminMember for: 10 years 11 months 19 days
[#9]: You do not have to use js-code, just put your link into the page with Content Editor Web Part: <a href="http://www.google.com">Google</a>.