Displaying setValue inside field on-click

Guys,
When I click a button, a uuid is stored into setValue on server side.
image
Then I want that value to display automatically on client side in a field, as if the field was refreshed after click and upon generating the setValue:
image
Desired info to display: http://website.com?id={{uuid}}

Any trick to do it without a DB query to get the uuid from a DB then do a server connect, then a load for a refresh of the form containing the field?

I’m guessing you’ll need the DB in any case so you can verify the uuid when it’s submitted. Or some kind of server side store and DB makes most sense

Other than that, the button is just a server connect form submit and the resulting data value is set on the client instantly. There’s very little overhead or code required

Indeed, uuid is stored in DB, for future verification.

But I feel I could use a shortcut for displaying it into my field on-click since the uuid in setValue is to be used instantly, for the purpose of sharing the link http://website.com?id={{uuid}} to some invitee.

All you need is a simple server connect form with a call to the API action. Store the uuid in a set value variable with output checked.

In the form server connect success event, append the value returned to the URL

Instant.

1 Like

I’m happy to create an example tomorrow AM (UK) you can use. Let me know …

1 Like

It’s 9pm here in France so I’m now off.
If you don’t mind, please do share, it will benefit all rookies in the community :grinning:
Else, I get it anyway and will share findings tomorrow.

Here’s a simple example. I’ve added it to an existing project as it’s quicker for me.

https://dev.orthobridge.eu/randUrl

To generate the unique ID I’ve simply used a sha256 with timestamp and ‘wappler’ key.

1 Like

I got this part, no problem. And I actually use wappler’s UUID in the Globals:

I also do use the SC to get the setValue across and I do use the on success event for setting the value to some text area:

My issue is how to display the refreshed url+uuid in that text area (or any kind of more appropriate field), like in your demo?

Take a look at my html source. You simply bind the value of the field to the form’s output value.

Note that my button calls form.submit() and isn’t a submit type … That’s the key to this.

1 Like

Right, the button type is ‘default’

For our readers:
I simply add an on-click event that submits the form pegged to the server connect.

Then I have a paragraph (no link field as I don’t want it clickable) with dynamic binding for the uuid returned by the form.
image
Paragraph is hidden when no uuid generated.

My API takes 250+ ms to complete (!), whereas yours takes ~50ms! I get that all servers are different but this timing gap seems huge. Are you using from specific type of fields that may be faster?

I’m not using any special fields. etc… Probably just my development server/environmental config and network latency.It’s a basic Digital ocean server running NodeJS based in London with some basic tuning to optimise it. I’d expect 30~50ms for this RTT