Forum Academy Marketplace Showcase Pricing Features

[SOLVED] How to discard the last input in a text field?

I want to user to edit a text field.

It can save it, reset it (to blank) but the issue is to not save modifications, and leave the field with the last saved text. How to do it?

EDIT - I made 2 fields: a) text, b) input text. I can made text field get value from input, but not otherwise.

Tried to redo with only 1 input text field, and still no go…I can’t overwrite an input field in workflows…

@csfalcao, try this… Text fields have “Initial Content” - use lastItem. This is what I did and it works, assuming this is what you intend on doing it should be ok.

Cheers

Thanks @ON2 but I can’t find “lasItem”. In Bubble documentation, it says it only works in repeating groups.

Edit a text field test should be a fair basic operation, and by “cancel” I mean discard text input, but Bubble saves it in real time. So how can I discard changes in a text field? I made a attempt with temporary hidden fields, still no go.

@csfalcao Here is a screenshot of what I did, perhaps this could help… If you want to delete the last Item saved, you could run a workflow to do so I believe. I can look into this and let you know later on.

Let me know if the screenshot helps.

1 Like

I’m not sure that I completely understand your question, but I’ll give it a go:

  • If you want an “input box” to display the same content as a “text box”, then just make a new “thing” in the database and have both the “input box” and the “text box” get their content (or initial content) from that same “thing”.

  • Any time the “thing” gets changed, both the “text box” and “input box” will get the same content.

  • If someone enters something into the “input box”, you would need to run the “reset content” command as an action in order to get it to display the content from the “thing” again.

Here’s a small test page I made on the Forum App.

I recorded a little video:

I change the text from “Idea 4” to “Idea 41”, and save (its ok)
Then I changed from “Idea 41” to “idea 41456” and not save (its ok)
Then comes the issue: when I edit again, the input field is “idea 41456”, I wanted to be “Idea 41”, the field text value. Can’t make the input field be equal text field, only initially.

Thanks @cakeheke and @ON2, but as a dynamic text, the “lastItem” will only get the initial state/text, as long you type, it will get the same behavior

@cakeheke suggestion will work, this is what I do in my blog editor. You don’t need to set it to “:last item,” you need to set it equal to the value in the database. So if you are saving this as an Idea’s Title in your DB, you should have a workflow that sets the input’s value equal to the Idea’s Title. I’ll build an example in the forum app when I get off work tonight, unless someone does it first.

It will work if you perform a “reload page” command. Still trying to work out another way.

I already built one in the forum app, and set a link to it above, but here’s another link for those who may have missed it…

I’ve got it… (discard my prior comments)

What you need to do, is put the input box inside a group, then run the “reset data” command…
I’ve updated the forum app to show this, here’s the link forum app

1 Like

Perfect @cakeheke! I didn’t know this action, only reset content.

But Bubble makes it a little awkward - the reset data only works on groups, so I had to create a group just to put the input field inside.

Thanks to all that helped too.

1 Like

No worries, man. I’m glad I could help.

1 Like

This is the result (workflow and UI), your help was greatly appreciated!

2 Likes

Cool, looks good.

1 Like