Ok. I have spent 3 hours on this and I am about giving up so I decided to post here for help.
What I want to do is update records in a database. I want to click on an update button or link for the update page to open with the specific record for me to update.
I have a page listing records from the database with an extra 3 columns having details, Delete , update buttons. The details button open a modal and delete does what it is supposed to do.
When I click on the UPDATE button, I want another page (update-record.php) to load the specific record from the DB for me to update.
I don’t want to edit all the fields of the record but just some selected fields.
How about passing a query parameter to the next page?
On your main list page you can add a button with a dynamic link. Add a query parameter to that URL and pass it the ID of the record you want to update:
Then on your update page you add a query manager with a variable of the same name (in this case record_id). You can then have a server connect action to a single query lookup by passing the record_id value.
hello @Hyperbytes I am certainly going to spend more time on your youtube channel after this project. Unfortunately for me, I have followed this video twice but still unable to get it to work. I suspect it is because this is not exactly what I am aiming for. I want the button to load another page for the update. ( The tutorial has the update form on the same page) which is different. Can you please help me with where I need to change something?
I have created the getrecord and updaterecord action files.
followed step until the part you add the update container to the page. this is where I get lost.
Since my flow is to get the update form on another page, how do i get the new page to select the record i want to edit.
I have tried this too. but got lost on the second step.
I am able to get the update page to open with the record ID appended to the url but When i fill the form, nothing gets updated. What makes me feel i did something wrong is the fact that, the form doesnt even show the existing data in the input area. See below. the record ID 17 loads in the address bar. but the update form does not show even the first name although the record has data in the first name column
I made a quick form with the form generator. The server action is the action I use to update the record AFTER it is loaded, modified and saved by the user. The Populate value is an action that retrieves the record.
Create record-list-page.php - this page shows your records in a table
On the above page, add BUTTON to one column to trigger the update page. add a Dynamic Attribute of a LINK and set it to update-record-page.php?id={{id}}
Create two action files. a. getrecords and b. updaterecords. (ensure you add the GET variable.)
Create the update-record-page.php page and add serverConnect using the getrecords action file . Then select the query id
On this same update page, select App and add QueryManager and Click Define query params and select the query shown.
Generate a bootstrap 4 form using the updaterecords and getrecords action files.
What did I miss in these steps that I still cant get this to work after all the help? My head is exploding…
So which part is not working exactly?
It's really not that hard...
You need one server action that's filtered by the URL parameter (already explained in the docs) which populates your form inputs.
Then you need the update record server action, which updates the data in the table, based on a hidden input ID.
Which part is not working for you exactly?