Using Modal to Add a Record and then redirect to a URL

I would appreciate some guidance on what would be a sensible flow.

I have a modal which has a form as the main body. Within the form I have PersonID which takes a value from a URL parameter and also a datepicker called planneddate. I want to add a row to my Order table when the submit button is pressed with these two variables (number for PersonID and date for planneddate).

Following success then I want to redirect to a different URL to allow the individual OrderLines to be added.

I have been working on this for hours and am getting brain dead…

I can’t work out what I should be doing in the modal or what I should be doing via a ServerConnect “on success” dynamic event or maybe there is a better way…

What’s exactly is the issue?
Do you have problems to fill in data to the database, or after that to implement a on success action?

Do you connect the form with a server connect action?

I can’t get a record added with both PersonID and PlannedDate. I am not sure what would be “best practice” to do this.

I tried a server connect action which links to a Database Insert via an action step. This allows me to add a record containing the PersonID but I can’t work out what to do include the date.

Separately I can’t see how to redirect to the new page which would handle the Order Items.

Thanks for taking the time to help me.

Could you please make a screenshot of the modal and form designed in the app-connect and the properties settings of the form. I think there is something not correct done.

Here are a set of screenshots.

I see that I have not set any actions in the form properties - which I guess is part of the problem.

In this screenshot I have a URL parament called id that determines which person from the person table this order is intended for.
wappler-1

wappler-3

wappler-5

Hello,
It seems you are doing this wrong.
I suggest you to start with our documentation so you get the logic of how inserting records in the database works:

Hi Teodor, yes I’ll start again - many thanks.

I have an Server Action for Inserting a single record to my Order table with the values left at the default Post variables.

I have deleted and recreated the modal and have used the BS4 form generator.

I have created a “server connect form” with the action using my “create_order” Server Acrion.

This looks fine on my test pages but no records are being added - I am obviously missing another step.

wappler-10

wappler-11

wappler-12

You need a submit button inside the form which submits the form…
Or if you are using a button outside the form, you need to use the dynamic events on your button in order to submit it.

Excellent !

I am using the dymanic events options and this is adding the two fields to a new Order record.

I am building things up one by one - so I now have a notification saying success for 5 seconds. If I then have a browser.goto (to go to my order items page) in the Dynamic Events list then it stops working.

How should I be doing a redirect to a different page ?