Make dynamic text change width of text box

Hello,

I want to add a “follow” button next to a users name. The issue is the follow button needs to be at the end of the users name, and users name changes in width depending on how long or short said name is.

How do you make a dynamic width text box or have a group/button move relative to the end of inserted text, rather than end of the text box itself. Ideally the text box width would move to compensate the added text, but on my screen it just adds a new line.

Any help is appreciated.

1 Like

you can’t do dynamic width of elements like that in bubble.

So you would have to put it all in a text element. luckily the text element does take bb code. i’m not at the computer at the moment. but you could to upload an image of the button, and try something like this.

[url=http://www.linkurl.com/][img]http://www.imageurl.com/image.jpg[/img][/url]

You have to use html, it’s possible but it means using the toolbox plugin for onclick events to bubble workflows so not exactly native, I use it in my app like this.

@casheets123 this is extremely limiting to use just images and icons, it’s not a viable solution for most developers.

Thank you both. In regards to the html option, I’ve built my button in html, and my html looks like this:-

Page creator’s username <button type=“button” style=“background-color: rgb(0,0,0,0);color:#a3a3a3;border-width: 1px;border-color:#a3a3a3;border-radius: 5px;padding:2px;padding-left:5px;padding-right:5px”=>Follow

What workflow do I run so that when the button above is clicked, I can pull the current user’s following field and then add the current page creator to said field?

-Install the plugin name Toolbox by Mishav
-add a BubbletoJavascript to your page
-set the publish event to true
-write this in your button onclick=‘bubble_fn_name’
-set the workflow for the element event

Hi Layer,

That doesn’t allow me to start a workflow for the button inside a html element. I don’t want user’s to be able to click their name AND the follow button to start a workflow, only the button part of the html, if that makes sense.

And I can’t start a workflow by clicking a html element. It won’t let me.

it will work, so write like this

<div>User's name<button onclick='bubble_fn_followuser('currentcellsusersuniqueid')'>Follow<button> </div>

only the button will trigger the workflow not the text, you have to create an event workflow from the element.

Appreciate the help so far, where have I gone wrong? Nothing happens when I click the button. Screenshots attached.




x4
x5

check the trigger event option, currentcellsuseruniqueid can be replaced with whatever dynamic text you want to publish.

the run javascript action is not needed, I replied with the other post just to show you the element.

and fix your button html, there should be no equal sign before the button close tag.

'bubble_fn_followuser(“currentusersuniqueid”) < what’s the point of the part in brackets if I’m not running a javascript action? if I put (“lalalalala”) it still works the way it should and makes a change to the current user’s following list, so why do I need the part in brackets if no matter what I write within it, it works the way I want?

so it’s working now? great.

this is to pass value around at the exact time of the button click event, it’s used in repeating groups where you can directly reference the cell. You could also use yes/no/number values here, or write some other javascript like ternary operator x >= y ? z : x

Yeah I had to change (‘currentusersuniqueid’) to (“currentusersuniqueid”) which made it work. I’d of never managed that without your guidance and thanks for teaching me a thing or two!

Is there any way to not pass the value, just purely have the onclick event without the brackets? All I need is to allow it to make a change but if I remove the brackets it breaks.

1 Like

sure just leave it empty ();

You’re a life saver.

Thanks again for helping, I’d of been stuck there for hours otherwise, if not longer! :slight_smile:

1 Like

Oh yeah for sure, it’s a very limited option. But that’s native bubble for ya sometimes. If you need a more robust set up, java is definitely the way to go here.

But if you just need to plonk down a quick button/icon/image what have you inside a text element, it will do the trick pretty well.

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.