Save as user types?

I’m working on a writing app and the goal is to get people writing quickly without worrying about length, so the initial text box is small and unintimidating, but I’d like it to grow and change a bit when it becomes clear that the user is writing a lot.

I’d like to auto-save the text once a user gets to a certain word count (or character if words isn’t possible) and then keep saving either based on words or time. What I can’t figure out is how to have this be seamless so I save the user’s content (create a new thing - POST) and then continually update the thing (Post) as they keep typing.

Here’s the desired flow:

  1. User begins typing in text box;
  2. At 50 words or 300 characters a user’s work is auto-saved and new Post created with their text in “Content” field;
  3. Now as user types, they are updating an existing Thing “Post”;
  4. Changes are made to the Thing “Post” in “Content” field as they type by saving a new version every 60 seconds;

At this point, I don’t care about version control and saving past versions. I just want to make sure their work isn’t lost if their browser crashes or something.

Thanks for ideas of how best to do this and make sure it’s seamless for user.

1 Like

This is what I would do…

First check for your 300 chars:

Then check save every 60 seconds after 301 chars but I’d also put in some kind of limiter here otherwise it could be saving needlessly - maybe after they submit or something?

1 Like

Thanks, that is very helpful.

One question: how do I make sure they are updating the current thing and not creating a new one on every save?

I noticed that if I have a text field and submit button, and don’t reset the field after submit, it keeps saving a new version everytime I push the button.

I would recommend when you hit 300 create a new comment field on your table. For this to work you need to have the unique userid on the table as well.

For the 60 second bit change to update data and “do a search for” the one for the current user that was created most recently - just check the date/time creation stamp. Same for submit just use the 60 second logic.

Then you’ll be saving the text once to create a new record. After that you’ll be looking for the most recently created record to update. Since the 60 second bit only comes after the 301 count you’ll be sure to not overwrite something not recent. But again I would put something there to make it stop saving in 60 second intervals.

Thanks. You lost me a bit, “a comment field?”

Sorry meant text field in your database table for whatever you want to use to hold your comments that people are typing :slight_smile:

If you link the text field directly to the thing in the database then won’t it be constantly saving after every change?

Enable auto-binding.

1 Like

This is great. Thank you. Could you expand on it a bit more. I read the description for auto-binding but don’t get what’s going on or the steps for the user in this case.

Auto binding lets you modify a thing automatically, as user modifies the input, without using a workflow. Check this box to enable this functionality. For this to work, the input needs to be in a group or a page that has a type of content defined. The thing of the parent group or the page will be the thing that will get modified.
For this to work, you’ll need to set the right permission for this type in the Data Tab, Privacy Section

Auto-binding means that, instead of using a workflow to commit a change to a thing in the database, the thing in the database is automatically updated whenever there’s a change in the element that’s bound.

So if the text your users are writing is just being put into a field of type text in the database, you could auto-bind the value of the text input to that field. I’d expect that to work as a sort of “autosave” function.

2 Likes

Sorry, I’m still new to this.

So I have a page with one text field and a “Save” button. The user hits “Save” after writing a bit so they don’t lose their work. I click the “auto-binding” field, but if the user hits save again it just creates a new thing.

What am I missing about how I need to set up the fields for autobinding?