Is there a way to make only part of a text clickable, for when a user types a hashtag, @, or url ,
ex: “I just saw @user”
ex 2: “I just went to http…website…”
, so then the @user or url is clickable while the other part isnt clickable?
I need specific part of the text to lead to different actions when clicked. I already have a specific action when the whole text is clicked in general but I would like to have the #,@, url parts to lead to other actions.
Yes, you can add BB code to make some of the text a link, and other portions not. The easiest way to do this is in the editor, select the text field and then click “rich text editor” and add a link.
Is this for static text? I need it for dynamic text so when a user includes a url, the url does a different action when clicked than the rest of the text.
You can add dynamic text within the link and you can make the link dynamic as well. For your use case, you’d need these 2 capabilities plus a way to identify when a user is adding a link. So, there’s probably a way to do it, but it probably requires a plugin or some custom code.
Have you looked at any of the Rich Text Editors than enable auto-suggesting of users (e.g., @username)? Perhaps one of them includes the ability to turn this into a link as well?
I will take a look at that and get back to you. I have not used Rich Text Editors at all, and have just relied on Extract with Regex. So right now I have an extract with Regex for links, for #, and for @, but I have those appear seperately outside of the text. I like how in most social media apps, when those elements are within a text, they are clickable and stay within the text as written. My current solution seems counter intuitive since I have these elements above or below the text after extraction with Regex.
Not sure. I can extract and present it as text below, but I am not sure how to make it so that each #word is standalone clickable, withouth theother #words.
Try adding BB Code with the instructions I started with. The first time, just do it with some text that you add yourself (not text from a user). You’ll see the formatting of the BB Code. Then, you can dynamically add this same formatting with Regex if you want, which would turn the user submitted text into links.
The problem is that my app doesnt have pages that are links. I want the text to show individual #hashtags that can be individually cliickable.
So a user would type #worldcup#fifa and the text would display each as seperate clickable texts. If you click on one of these, it would show you a group that searches for other posts with that #
I have a thing called a post, with a field called “post text” and “hashtag” (hashtag is a list of texts).
Post text= input value
Hashtag= input value:extract with regex (regex extracts hashtags)
When I look at the app data, if a user posts: #word#word#word,
the field for hashtag lists #word, #word, #word
so far so good, but when i try a repeating group or i try to use dynamic text to display the first item of the hashtag, it lists #word#word#word as 1 item in the list. They are grouped as 1 entry.
I need a way to make them separate items in the list of hashtags so that i could have text that displays the 1st item, 2nd item, etc.
This means the regex needs tweaking, at the moment it is matching too much, so that you have a list of one item. Try something like: #\w+
Edit …
For making links in the text with BB, I used the rich text editor to come up with an example. :find & replace
regular expression: @(\w+)
replace with: [color=#0000ff][url=https://myapp.example.com/user?uid=$1]@$1[/url][/color]