Skip to main content
Nintex Community Menu Bar
Answer

Is there a way to force links in Forms to open in a new tab?

  • October 13, 2015
  • 6 replies
  • 485 views

Forum|alt.badge.img+4

Is it possible to force links to open in a new tab from a Form?

 

I have a workflow that creates a subfolder in a Doc Library and then writes the link back into the form. It'd be nice if when the user views the form, they click the link and it opens into a new tab.

Best answer by christopheraucq

Hi Jonathan,

You need a Nintex Form for your Doc Library

For your DocFolder field Control Settings, under Formatting, for CSS class, append  cssfldDocFolder.

It should appear like this: nf-form-input cssfldDocFolder

Then can create a Rich Text Control in the Form.

In this control, under Formatting, in CSS class, fill in MyRichTextControlClass

In Form Setting, under Custom Javascript

NWF$(document).ready(function () {

    var strDocFolder=NWF$('.cssfldDocFolder').text();

    NWF$('.MyRichTextControlClass').html('<a target='_blank' href=''+strDocFolder+''>'+strDocFolder+'</a>');

});

Please note that this will work in View mode only, this is why we get the value of DocFolder using CSS instead of Javascript value: .val()

Regards,

Christophe

6 replies

Forum|alt.badge.img+9

Hi Jonathan,

How do you write the link?

If you can add target="_blank" in your a href tag, it should solve you issue.

<a target="_blank" href="http://your_url_here.html">Link</a>

Regards,

Christophe


Forum|alt.badge.img+4
  • Author
  • October 17, 2015

Hi Christophe,

I use the Set Field in Current Item > Encoded Absolute URL


Forum|alt.badge.img+9

Hi Jonathan,

You need a Nintex Form for your Doc Library

For your DocFolder field Control Settings, under Formatting, for CSS class, append  cssfldDocFolder.

It should appear like this: nf-form-input cssfldDocFolder

Then can create a Rich Text Control in the Form.

In this control, under Formatting, in CSS class, fill in MyRichTextControlClass

In Form Setting, under Custom Javascript

NWF$(document).ready(function () {

    var strDocFolder=NWF$('.cssfldDocFolder').text();

    NWF$('.MyRichTextControlClass').html('<a target='_blank' href=''+strDocFolder+''>'+strDocFolder+'</a>');

});

Please note that this will work in View mode only, this is why we get the value of DocFolder using CSS instead of Javascript value: .val()

Regards,

Christophe


Forum|alt.badge.img+4
  • Author
  • October 21, 2015

Thanks! I'll give this a shot.


Forum|alt.badge.img+4
  • Author
  • November 4, 2015

Hey Christophe,

When I added the CSS class, MyRichTextControlClass and Custom Javascript, it made everything blank on the form upon publishing.


Forum|alt.badge.img+9

Hi Jonathan,

This means that your Javascript code is not well formed.

Please follow this link to make sure it is right

https://community.nintex.com/community/dev-talk/blog/2015/06/23/video-writing-custom-javascript-in-nintex-forms-for-shar…

Regards,

Christophe