Get newly created record id on next page after form submit and display record details

Hi,

I have a insert form that creates and order, one submit I need to pass through the newly created id onto the next page so that I can retrieve the order details fro the users - its the confirmation page after submitting the order.

I know I am missing a step, I just don’t know where to pull out the id after the insert in DB has been created.
PHP

Try having a look at this one.

hi @brad, I watched it, but for some reason the ID does not come up in the url. I don’t know where I am going wrong? any ideas? I do have "Confirm Dialogue’ which may be causing the issue? just not sure how to resolve this?

<form is="dmx-serverconnect-form" id="serverconnectform1" method="post" action="dmxConnect/api/orders/order_create.php" dmx-generator="bootstrap5" dmx-form-type="horizontal" dmx-on:submit.prevent="run({'bootbox.confirm':{message:'Confirm and book?',title:'Confirm',buttons:{confirm:{label:'Yes, confirm and book',className:'btn-primary'},cancel:{label:'No, cancel',className:'btn-danger'}},then:{steps:{run:{action:`serverconnectform1.submit(true);browser1.goto('order-test.php?ord='+serverconnectform1.data.get_order.ord_pubid);sc_pck_item_list.load({},true);sc_orddetail.load({ord: query.ord},true)`,name:'submitform',outputType:'text'}}},name:'confirmsubmit'}})">

The id comes from the sc_orderdetail?
Check the order of the “selected action”
Try to load the sc before the “go to” browser action

Btw you can use the dynamic event “success” on the form instead of a flow, and those actions will be executed with a form being sucesfully submited

@franse no the id doesn’t come from the sc_orderdetail )thats for something else after submitting). The id from from the data under server connect form from the Server action.
If I use dynamic event success on the form, then I don’t get the “Confirmation Dialogue”. The whole point is that this work when I do it without the “Confirmation Dialogue”. I need the form to display an alert to confirm the submission before submitting it.

Hey @cpuser,

You have to pay attention on the order that actions take place…

You call your Confirmation on the form Submit event. And in your Confirmation you already pass the form data that are empty.
After that you call the browser.goto(…), meaning that the actions stop there because a new page is open…
image

So, let’s place them in the right order:

  1. Please change the submit button to type “Default” in order to control the action
  2. Instead of the form Submit Event set a Click Event for your submit button and submit the form.
  3. Now add a Success event on your form and call the:
    browser1.goto(‘order-test.php?ord=’+serverconnectform1.data.get_order.ord_pubid)
  4. After that point, you have to continue on the order-test.php page

The page that all of these steps take place (1,2,3) is order-test.php?
We need that answer first in order to tell you what happens then…

*And a last advise:
image