Update form does not work

Hi all,
i am facing issue, not able to perform any sort of field update within the form,
I have followed the lesson here: https://wapplerunwrapped.online/videoplayer.php?id=16

here is the info, please advice where is my mistake, as i can’t see any error


i have created 2 server actions:
updateuserbyid = is to write updates
userbyid = to get data.

here how it is set :slight_smile:


then i have created a page, added serverconnect and queary1(ID)

created generated form with these params:

I have removed the ID field from the form, so it it can not be modified.
url to page.

for testing i have tried changing only mobilephone value or name value,
nothing is saving.

please help

I have added notifications, in order to try catch connection to DB issues, without success…


1 question, is this using the new node.js or php, mysql.

Other than that, the only thing i see that seems a little strange (not wrong per se) to me is the use of id, personally for SQL databases because of table joins and other things that come up I try prefix all database column names.

If i had a Table called user_data as an example, i would have ud_id, ud_name, ud_email etc. which firstly makes life easier at a glance knowing what table each piece of data comes from, makes it that I never have 2 tables that both have a column called id so when needing to join I have to make aliases, and also avoids using special names that could have some significance in the program i am using.

Even reading your very clearly laid out question i had some difficulty figuring out the id.

In your case I would start off with checking in Google Chrome, when you have the form open and a user loaded, open the developer tools, then open the network tab, and click the filter to filter to XHR, now submit your form.
The server action linked should come up red, and when you click on it and go to either preview or response you should see an error as to what it is unhappy about. I imagine you are not meeting a requirement of the SQL, so either the date is not being sent in a proper ISO Date format, or the enum is not sending a known piece of data, or an int is actually being sent a string.

Paste the error here if it does not make sense and we will try point you in the right direction.

1 Like

thank you for advice regarding fields name, i will implement it.

as for XHR,
i have opened a form, tried to add to mobilenumber field some numbers, and saved,
XHR showed no error…

as for issues with some field types, i thought about it too, so i tried removing some fields, leaving some text fields and dates.
it didn’t help, no data was saved.

please advice what else needed to be provided from my side in order for you to have full picture.

Are you using Node.js and if you do not filter by XHR are there any scripts giving errors.

no, its php, mysql
no errors that i can see from the browser.
you can test the url yourself, i`ve shared within the post. it is active

Yeah, no error at all, it all seems to be in order and should be updating.

Could you paste your code here so i can see the pages code. also please make sure to do a full publish incase anything is missing on the server.

Just checking something, the id is missing in the form, so it can not really run it’s condition. I will know more once i see you code though.

what do you mean paste my code?
edituser.php code?

Its ok, I see the issue, it is because you removed the ID field.

On the form instead of removing the id part you need to just make this hidden

For future reference the code i was mentioning is when you change from design view to code view or split view on the actual page, so the code from edituser.php

@psweb, thank you. I got it,

few final questions

  1. why wasn’t validation showing error, but rather showing success ( form --> dynamic events --> server connect --> success.

  2. in the table i have field such as place - where it stores placeID.
    other table stores placeID, PlaceName.
    Is it possible to show the user via join Place Name, and if changed, the update will be of relevant placeID.

thank you for your assistance. really appreciate it.

To be honest, i am not 100% sure on that one, I can assume that the update was technically successful in that all the data was correct however the SQL side did not know what record to use the data for, or because there are multiple ‘id’ fields maybe something is getting a little confused.
There is an id from the url parameter, then another in the $_GET, then another in the $_POST and a last one in the update itself, which as I explained earlier i have honestly never tried.

I would have had my SQL table with ud_id my URL parameter for the $_GET i would have also called something different like qy_id short for query id, so not sure how it could possibly confuse things. @Teodor would have more insight on that one.

If you have a table for place with an ID for each and a name that correponds then make another query to fetch all the place names and ids, then bind that data to a select, with the id pointing as the value and the name as the name.
Once you have that working then as a second part you just need to bind the value from your existing userbyid server action as the selected value.

I know this part can be a little confusing, if you are stuck I will try explain in more detail.

Here is a rough example.

So you have another server action called get-all-places which does a query of all the places you want to be available to your user to choose from.

You change your existing Place form field in your form to a select rather.

The properties of the select have 3 areas I have labeled 1-3

Area 1 allows you to add some custom listing if you want, handy for an enum field where the answers are going to be yes/no or whatever, also handy for an insert form where you want a default of Please Select with no value at all.
In your case as an update form I would remove all 3 from there so it is empty.

Area 2 is going to take what is returned from the get-all-places server action
Data source takes the entire query, Text Field takes place names, Value Field takes all the values.

Area 3 is going to take what is returned from the userbyid PlaceId.

Hope that helps.

1 Like

Please don’t use offensive language, my pet hate! :grinning:


mwahahaha, i use enum every so often, i will admit, I did not even know they were bad, lol.

Any reason you avoid them Brian?

If you use a select based on an emum and add a new element then you have to resort to code changes to redefine the select to match the emum values as there is no call to retrieve a value list (at least not easily, needs code)

using a dynamic lookup, adding an element dynamically changes the select contents

So even with something as simple as Yes/No, if used in lots of places can lead to loads of time to find each one and update it.

i.e. adding “Maybe” to yes/no or “Don’t want to say” in Male/female type gender questions

I create a small table with options, call that and ensure it is cached so it is not called repeatedly.
Add the option to the table, every select reflects that change

1 Like

Is this where Brian goes off on a rant?

What me? Never. I just enlighten people to their mistakes :innocent:

1 Like

Fair enough, that makes sense.

I have to admit the only time i really use them is with radio buttons, which i do generally avoid anyway, don’t know why, just don’t like them.

Although with selects even when not inside an enum field if it is something I know is going to be fixed like a payment terms, of “cash on delivery, 30 days, 60 days” or a delivery method of “collect, deliver, counter to counter freight” I will often find myself not doing a query to populate the select and rather just making a static one, because it’s easier. Even though its not an enum and a proper table with say delivery methods, because most of the time it would be relational it would still break if the client wanted to add a new method and make my go back into code for adding. It is lazy I know.
EDIT: I do see what you are saying though, at least i have the option of calling the values if I want, whereas an enum I can not even call the acceptable values if I wanted to, the penny just dropped.

In fact if there is one thing I probably do over use it is primary and foreign key relational databases, which I have often wondered if I should actually not do at all. I mean most relational logic could be built on the app side without the need for a hard relationship being set in the database.

I confess I rarely hard code relations or use triggers. Like to control everything manually but that’s just my preference, doesnt mean it is necessarily best practice

I think the only reason I like them is because of “on delete cascade”, “on update cascade” otherwise I probably would never use them, but I do like that when i dump the main record then all its bits are removed at the same time, well “sometimes” when i have fully thought it out. I have caused myself disastrous results with it too, when i have not fully imagined what it could delete. haha.