Skip to main content
Nintex Community Menu Bar

Nintex Forms Javascript how to convert input into a Hyperlink

  • Apr 10, 2018 2:52 PM UTC
  • 9 replies
  • 119 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
  • Apr 11, 2018 6:42 AM UTC

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
  • Apr 11, 2018 6:57 AM UTC

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

Translate

Forum|alt.badge.img+14
  • Scholar
  • Apr 11, 2018 7:03 AM UTC

Forum|alt.badge.img+2
  • Author
  • Apr 11, 2018 7:45 AM UTC

But how would i change then the variable? 

Translate

Forum|alt.badge.img+14
  • Scholar
  • Apr 11, 2018 8:08 AM UTC

I'm not sure what you mean...

Translate

Forum|alt.badge.img+2
  • Author
  • Apr 11, 2018 9:46 AM UTC

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
  • Apr 11, 2018 11:05 AM UTC

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
  • Apr 12, 2018 8:28 AM UTC

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
  • Apr 12, 2018 8:51 AM UTC

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

Translate