Forum Academy Marketplace Showcase Pricing Features

Autobinding a thing from a group to user


I’m trying to make the app remember the thing that the user was checking out on the previous time so that it could be recalled on page refresh and/or navigating away and back again.Using a workflow to save it in a field under user would be a huge waste of workflows… So I started thinking that if it could somehow be auto-binded?
@emmanuel, anything?


On the page load (or wherever you want) not write to a custom state which is linked to a hidden input field, which itself is bound to a database field?

Ooooooh. Nifty.
So you mean that I can store the thing’s unique ID as a text and use it for a later search?
I’m struggling, though, to complete the cycle.
Getting the field synced is easy, but how would I make an automatic update to a binded input? binding with a database thing kind of excludes getting a value automatically from another visual website element…

I am just going for my dinner, I’ll have a play after…see if it is possible or not.

Well, I’m getting there.

So far I have a textbox and input field, when the user ‘views’ an item, the item ID is pushed to the text box via a CustomState on the input. The input placeholder is set to the value of the CustomState.

If I then manually run this javascript below, I can get the id of the thing viewed written to the current users via autobinding and without incrementing the workflow. I use the HoverText of the Text and the Placeholder of the Input to be able to correctly find the elements on the page.

All I need to do now is work out how to monitor the text field for changes to automatically fire off the javascript. This script would then be pushed into the page using an html element.

I will continue this quest later! my head hurts…:tired_face:

//removed old script, see updates below…

Ok, looks like I have sussed it.

I have created this demo for you. I have done everything on the one page, but you could just as easily move the various parts onto different pages, but the key thing is it is possible to force autobind values into the database without incrementing workflows.

The final script I used was;

//Set up an event to monitor for textfield changing
  //Fire the update function
function writeUpdate()
  //Create a variable to hold the viewed UID of the object
  var TheUID = '';
  //Search for the text box containing the viewed UID and write to variable
  TheUID = $('[title="ViewedID"]').children('.content').children().html();
  if ($('[placeholder="' + TheUID + '"]').val() != TheUID)
      //Find the input element that has a placeholder mathching the UID and write the UID into the value field
      $('[placeholder="' + TheUID + '"]').val(TheUID);
      //Trigger a change event
      $('[placeholder="' + TheUID + '"]').change();

The link to the demo and the editor are below;


1 Like

Coming in late to the party … at least the music is still playing.

Interesting script there @DaveA! You could take a shortcut, and pass values directly into the script with dynamic values, keeping in mind that the entire script is rerun on the values changing.

This has been done in:

and in:

1 Like


I never considered add the dynamic values directly into the script. I knew it could be done, but just never thought about it! I guess I’ve still got the raw js hat on!

I’m sure there are also other optimisations to do, but I was just trying to get something working as per the challenge set!

1 Like


Thanks a ton, @DaveA, my users are going to enjoy the app so much more! :slight_smile:
Will try the function out soon as a next big thing.
@mishav, thanks for the references!

Gotta love the bubble community… :sunglasses: