Failing to Pass Posted key id value inside SPA

I have a multi-step form to insert a new record.

After the user submits the form and it is saved to the database table the next step that appears is to show a read-only table confirming that the submitted form is now saved in the database.

I don’t want to pass the value in the url that I’m using as a query filter to select one record by its unique key .
But everything “Wappler” I have tried from docs just gives me a blank table when the query runs because it is missing that key id.

This key_id changes with each record submitted and I’m not using the autoincrement key.

I have tried to do all of this inside the API that inserts the record.
After the insert action runs then I added a
Set filter $value = the just-posted field $value
Next and final API step is the query to retrieve the same record using my filter variable as the SELECT * WHERE condition.

I have tried all kinds of methods with API s and Library Actions.
Then I couldn’t access the Library action after setting it up from the docs.

This is normally easy when I just used PHP functions and called them where I needed them on a page.
But the “flow” in Wappler is eluding me here.

Can you place a screen capture of the API steps so that we can see what you have done.

How are things in Gloccamorra, Ben?

Thanks for stopping by!

Okay, here is one effort of trying to follow docs and set up a Library action. From the PARAM which I renamed exactly the same as Name field value story_ID I then set up a query to go to the table where the insert API for this user has saved a new record, and filter it with the Param story_ID
I seem to have the choice also of a $_POST.story_ID & I have tried both.

!

I know the query works generically without a filter value passed in to WHERE.

But then 2 things –

  1. I don’t know how to access this Library action except to call for it inside an API – like the next step after my insert API has done its job.
    Then utilizing an api where I called in my Library action does not produce a table with values either.
  2. I have tried and tried to do another server connect on my insert form page that I could base a Bootstrap 5 Table generator display on. But the bind values I assign still don’t fill the table with values.

The answer is - use sessions.

Enable the output option for the insert step in your insert server action.

On the insert page you add the session storage manager, define a session inside it and on success event of the server connect form set the the identity returned by the insert step, as the session value - it’s available in the data picker.

On page 2 create a session storage manager, define the same session (same name) as on the insert page.
For the details server action used on that page, create a GET variable (no $_POST, no library stuff, no $_PARAM). Create a single query, filtered by this GET variable.
Include the server action on page 2 and select the session as a value for your get parameter.

You are done. Nothing complicated.

1 Like