FinWell Posted June 3, 2017 Report Share Posted June 3, 2017 Hi, I am updating an html block in a datapage form. I tried using this code and tested that the logic works with regular text. But whenever it tries to write the hyperlink, it displays nothing instead. Thanks for any help. <script language="javascript"> var samp='[@field:Table_Sample]'; if (samp.length>0) {var str = "New Record"; var result = str.link("https://www.sample.com");} else {samp = "Update Record" document.write(samp);} </script> Quote Link to comment Share on other sites More sharing options...
Mathilda Posted June 16, 2017 Report Share Posted June 16, 2017 On 6/2/2017 at 6:10 PM, FinWell said: Hi, I am updating an html block in a datapage form. I tried using this code and tested that the logic works with regular text. But whenever it tries to write the hyperlink, it displays nothing instead. Thanks for any help. <script language="javascript"> var samp='[@field:Table_Sample]'; if (samp.length>0) {var str = "New Record"; var result = str.link("https://www.sample.com");} else {samp = "Update Record" document.write(samp);} </script> Hi, I edited your script a little bit. Try using the following code: <p id="demo"></p> <script language="javascript"> window.onload=function my_func(){ var samp='[@field:Table_Sample]'; if (samp.length>0) { var str = "New Record"; var result = str.link("https://www.sample.com"); document.getElementById("demo").innerHTML = result;} else {samp = "Update Record"; document.getElementById("demo").innerHTML=samp;} } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.