Jump to content

How to have a url in a calculated field


Recommended Posts

I want to have a calculated field where the user either sees a link to click on (which redirects to a document), or sees a message "The document hasn't been uploaded yet".

I tried to do this by having the following in a calculated field:

CASE

WHEN [@field:File]<>'' THEN [url="[@field:File]"]Click here to read the document[/url]

ELSE 'The document hasn't been uploaded yet.'

END

But this doesn't work. When I want to go the the details page I get Error in formula.

Do you have any suggestions? I can't upload the file to Caspio, so that is not an option.

Thanks!

Bjorn

Link to comment
Share on other sites

I want to have a calculated field where the user either sees a link to click on (which redirects to a document), or sees a message "The document hasn't been uploaded yet".

I tried to do this by having the following in a calculated field:

CASE

WHEN [@field:File]<>'' THEN [url="[@field:File]"]Click here to read the document[/url]

ELSE 'The document hasn't been uploaded yet.'

END

But this doesn't work. When I want to go the the details page I get Error in formula.

Do you have any suggestions? I can't upload the file to Caspio, so that is not an option.

Thanks!

Bjorn

Hi Bjorn,

You cannot write HTML code in calculated field. The best solution is to add html block with Java Script instead of calculated field:

if( '[@field:File]' != "")

document.write('Click here to read the document');

else

document.write('The document hasn't been uploaded yet.');

Link to comment
Share on other sites

I want to have a calculated field where the user either sees a link to click on (which redirects to a document), or sees a message "The document hasn't been uploaded yet".

I tried to do this by having the following in a calculated field:

CASE

WHEN [@field:File]<>'' THEN [url="[@field:File]"]Click here to read the document[/url]

ELSE 'The document hasn't been uploaded yet.'

END

But this doesn't work. When I want to go the the details page I get Error in formula.

Do you have any suggestions? I can't upload the file to Caspio, so that is not an option.

Thanks!

Bjorn

Hi Bjorn,

You cannot write HTML code in calculated field. The best solution is to add html block with Java Script instead of calculated field:

if( '[@field:File]' != "")

document.write('Click here to read the document');

else

document.write('The document hasn't been uploaded yet.');

Beautiful casyana! Thank you so much for your reply!

Have a nice week! :)

Link to comment
Share on other sites

  • 3 years later...

Hi Bjorn,

You cannot write HTML code in calculated field. The best solution is to add html block with Java Script instead of calculated field:

<script>
if( '[@field:File]' != "")
document.write('Click here to read the document');
else
document.write('The document has not been uploaded yet.');

</script>

 

Thank you, Casyana!

Link to comment
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...
 Share

×
×
  • Create New...