How to use Server Connect Form with RESTful routes?

Let’s imagine a library website

Current page: Edit book “Harry Potter”

Route: /book/edit/:bookID
URL: example.com/book/edit/1
Server Action: book/edit

Placing a Server Connect Form on this page allows me to select a Server Action, generating the following code (excerpt):

<form is="dmx-serverconnect-form" id="form_book_edit" method="post" action="/api/book/edit" dmx-generator="bootstrap5" dmx-form-type="horizontal">

How can I make action="/api/book/edit" carry the book ID? Like so:

action="/api/book/1/edit"

For this use case, I don’t want to use a hidden input field to carry the ID. The goal is to follow RESTful routing convention as closely as possible

Not at computer, so this likely has mistakes, but I think you get the point.

dmx-bind:action='/api/book/' + query.bookID + '/edit'

1 Like