Form inserts two records

OS info

  • Operating System : Windows 10.0.18362
  • Wappler Version : 2.2.3

Problem description

Bootstrap4 form. Saves to records in the databse on submit, the second one empty. Also I can not get the form to redirect to another page. Followed all the turioals, but no luck

Steps to reproduce

screen2

Hello, is this an insert form or an update form?
Do you mean it saves TWO records in the database? Can you provide a link to your page where we can test this?

An instert form. And yes it saves two records to the databse. typo, sorry…
https://tw60.transportsystemerjohnnysolberg-321a.websitebuilder.no/kunder.aspx?kundeid=40001

Update. I have now removed the form from the page, and just put in a button with a link to a new page. And still it inserts a blank record in my database…

@Johnny_Solberg
Can you tell me on which link i can preview your form which inserts two records?

Please when posting a problem with a link to your page(s) don’t change or remove them until we check what’s wrong.

I found your page containing the form.
The problem is that you have added a server connect component on the page, which runs the same server action as your form runs:

So on page load it runs the insert action, which of course inserts a blank record.
Then on form submit the insert action runs again and inserts the data.

You should not the server connect component on that page - the insert must only run through the form.
And also - for insert record action, you should not use the “populate” option of the form generator. It’s only needed for an update record form, where you need to see the record which you are updating.

So that basicly means you can not save something to a database on a page where you display data?

Not sure what do you mean?
Your insert server action must be separate than any server action returning data on the page!

That’s kind of hopeless… on this page I need to display costumer name (Kundenavn) and costumer ID on top of the page to make sure it is the right costumer I have choosen.

You need two separate server actions for this.
The server action which inserts data must only contain the insert step.

So I need to have one server action with all its steps and globals for inserts, and one server action for all views?

Insert, update and delete actions must be in their own separate actions.
You cannot have insert step within a server action containing some database query, as every time you call the query it will also run the insert step …

Please make sure to check the basics of using server connect:

Sorry, the construction of Wappler, is so different from Dreamviewer that I get confused sometimes, better in many ways, but some basic task is so much more work