Getting field data to display as a link

I have a field called name in a form called people_files which stores uploaded files.

When the user clicks on tha name field I have an onAction method which calls a method named DownloadFile which opens a SaveFile dialog and lets the user select to where the file should be downloaded. That all works fine.

If possible, I would like the values in the name field to show up as an HTML link. So, I created a calculation in the dataprovider called name_html and set it to:

return "<html><head></head><body><a href='DownloadFile'>" + name + "</a></body></html>"

I also set the DisplayType of the field to HTML_AREA and now I get the data looking exactly like what I want.

The problem is, when I click on the field, I no longer trigger the onAction method.

Any idea what I can do about this?

If you want to trigger methods in HTML you need to use the following code:

return "<html><head></head><body><a href='javascript:DownloadFile()'>" + name + "</a></body></html>"

Ofcourse this only works if your method has exactly that name and is a form method.
When it is a global method you need to prefix the name with “globals.”.
Just like you do in methods themselfs.

That worked.

Thanks!!!