I’ve created a comment box that users can fill to post a comment via a user input; their comments are then displayed publicly on a page.
I would like to know if it was possible to detect when a link is posted to make it clickable, since Wix Text Boxes make links plain text (no decoration, no clickability)
there is no way to do it automatically at the moment. But you can add your custom code that formats text links as clickable links.
For example you could use Rich Text type for comment. When user clicks submit, you could match URLs with regex and replace them with HTML a tags to something like link.
I’m not sure I understand it correctly.
There is no rich text input provided by wix unfortunately, so I can’t set up a rich text field in my collection. All I have is the “big” box that only takes simple text. My idea was to create some kind of if condition like :
if a piece of text in repeater 5 begins with http OR www then make it orange and clickable
Yes, you would have to use simple text, but that’s the idea - replace the text with HTML. You can use Rich Text (HTML content) in database and as an output.
I use my (imperfect) RegEx to find URLs (basically anything that starts with http: or https: up until space) and replace it with HTML for URL placing the URL in appropriate palces (the $1)
Taking that resulting HTML and putting it to a text component. But instead of setting via value property I am using html so it sets the HTML formatting.
You could use Rich Text field in your collection and do a conversion before saving the value to the database. If you’ll bind Rich Text values to text components, Wix will know to use the HTML correctly (when binding it will not work with fields of Text, as it will just display the HTML in text).
To make it orange just apply a bit of styling via style attribute on a tag (ex. style=“color: orange”).
I tried many things, but couldn’t find any solution !
That’s the last thing I need !
I think the best way is to keep the simple text field and just “read” the displayed comments and when the code reads ‘https’ or ‘www’ then it turns it into orange and clickable (and open the link in a new tab)
The blog article very surprised to me! Your writing is good related to personal care In this I learned a lot! Thank you!, please checkout more information on Lotus Notes Lotus Notes Developer