Skip to main content
Nintex Community Menu Bar

Nintex Forms Javascript how to convert input into a Hyperlink

  • April 10, 2018
  • 9 replies
  • 118 views
  • Translate All

Forum|alt.badge.img+2

I'm trying to copy the user input from a singleline Textbox to a Label and convert it into a hyperlink:

//Converts it through a button

function test(){
var richtext= "";
var link = NWF$(".richtext input").val();
if(link.indexOf('http://')>=0){
var nohttp = link.replace("http://","");
richtext = '<a href=http://'+nohttp+' target="_blank">'+nohttp+'</a>';
NWF$(".calvalue").html(richtext);

}
}

This works fine but after i save it and i want to display it (in the Dispform), it didn't save it at all.

Does anyone know how i can save html code to a label or control?

9 replies

Forum|alt.badge.img+14
  • Scholar
  • April 11, 2018

if you replace control's HTML markup you destroy control's DOM model which nintex relies on.

so you can not expect nintex will save any value then.

Translate

Forum|alt.badge.img+2
  • Author
  • April 11, 2018

So there's no option how i can dynamically display a hyperlink?

Translate

Forum|alt.badge.img+14
  • Scholar
  • April 11, 2018

Forum|alt.badge.img+2
  • Author
  • April 11, 2018

But how would i change then the variable? 

Translate

Forum|alt.badge.img+14
  • Scholar
  • April 11, 2018

I'm not sure what you mean...

Translate

Forum|alt.badge.img+2
  • Author
  • April 11, 2018

In the example you gave me: 

"<a href=""http://www.mydomain.com/user=" + varAppendToLink + """> click here </a>"

How would you dynamically set the "varAppendToLink" variable with JS?

Translate

Forum|alt.badge.img+14
  • Scholar
  • April 11, 2018

no javascript is needed.

varAppendToLink is named control reference. once the referenced control changes formula is recalculated and link updated automatically.

Translate

Forum|alt.badge.img+2
  • Author
  • April 12, 2018

Okay that works, but on dispform it shows as plain HTML, how do i change it? 

214354_pastedImage_1.png

Translate

Forum|alt.badge.img+14
  • Scholar
  • April 12, 2018

you have to configure calculated value control to recalculate in VIEW mode

Translate