The resulting string was displayed correctly. One can copy the string and paste it in a new browser tab/window. However, the purpose is to enable the user to click on the field to open a new browser tab/window.
The HTML code was escaped, so it displayed correctly but did not result in a clickable link.
This is a great idea! We already have an URL field and so the formula field should definately also support this. I’m thinking perhaps there should be a function like url('http://your-text-here.com') That will display your text as an URL field, do you think this solution would suit you well? There might be other ways of doing this like a checkbox option perhaps on the Formula field edit menu? But that seems inconsistent with the other field types.
A styling option for the formula column, rendering all fields as URLs, would also solve this. However, I concur, the canonical resolution appears to be a separate keyword.
@honeycut Awesome! The link you shared doesn’t work for me, I think your fork is private.
So I was thinking the way url would work is that we’d introduce a new Formula Type called the BaserowFormulaLinkType.
This is because atm the way we decide how to render a formula in the frontend is by using its formula_type. For example if you write a formula like 1+1 the backend calculates it’s formula_type is number and then the frontends BaserowFormulaNumberType then has methods which define how to render a formula of that type (BaserowFormulaNumberType.getFunctionalGridViewFieldComponent etc).
And so I’d imagine this way of solving this issue would look like:
There would be a new backend BaserowFormulaLinkType
I think this would be a copy paste of the existing BaserowFormulaCharType but perhaps with a slightly different cast_to_text implementation.
There would be a new backend function called BaserowUrl which returns a formula of type BaserowFormulaLinkType and perhaps saved to the database a string like f"url=label" instead of raw html
There would be a new web-frontend BaserowFormulaLinkType once again very similar to the BaserowFormulaCharType but instead defining its own components which render it
There would be a new FunctionalGridViewFieldFormulaLink and RowEditFieldFormulaLink components used by BaserowFormulaLinkType which split the value to get the url and label components, and then render those as a link something like
... todo copy the rest from something like web-frontend/modules/database/components/view/grid/fields/FunctionalGridViewFieldText.vue
<a href="this.$options.methods.getUrl(this.$props.value)">
{{ this.$options.methods.getLabel(this.$props.value) }}
</a>
... todo implement the methods getUrl and getLabel