Page 1 of 2
Adding an hyperlink or a button in a form
Posted: 21 May 2013
by ninkasi
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
Re: Adding an hyperlink or a button in a form
Posted: 21 May 2013
by Dmitry Kozlov
You can add hyperlink or button with javascript. In the following example I'm adding a hyperlink 'Test' at the top of the form
Code: Select all
$('#fd_form').prepend('<a href="http://test.org">Test</a>');
Put this script into JavaScript editor in Forms Designer.
Re: Adding an hyperlink or a button in a form
Posted: 22 May 2013
by ninkasi
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.
Re: Adding an hyperlink or a button in a form
Posted: 22 May 2013
by Dmitry Kozlov
You can define CSS-class for field or table cell:
Define CSS class
Then insert into it your link:
$('.my-class').prepend('
Test');
Re: Adding an hyperlink or a button in a form
Posted: 22 May 2013
by Dmitry Kozlov
Code: Select all
$('.my-class').prepend('<a href="http://test.org">Test</a>);
Re: Adding an hyperlink or a button in a form
Posted: 28 May 2013
by ninkasi
Thanks again for your quick answer, I was on the right way but was mistaken # and . !
Re: Adding an hyperlink or a button in a form
Posted: 17 Jun 2013
by mgilbert
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.
Re: Adding an hyperlink or a button in a form
Posted: 17 Jun 2013
by Dmitry Kozlov
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.
Re: Adding an hyperlink or a button in a form
Posted: 17 Jun 2013
by mgilbert
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!
Re: Adding an hyperlink or a button in a form
Posted: 17 Jun 2013
by Dmitry Kozlov
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>.