Jump to content

Recommended Posts

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>

 

Share this post


Link to post
Share on other sites
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>

 

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...