I have created a form for members to edit data and submit. Basically a recommended services form. It works fine…
I decided to “prefill” one of the fields with the members name - to save time. This works fine.
When the form is submitted, the prefilled value is not picked up. This is weird as it is a required field and the submit goes through without an error. So it knows the field is filled. But the value does not get submitted.
If I tweak the value it works. So it is prefilled “John Doe” and if I add an “s” to the end (to make it “John Does” that does get submitted.
Interesting problem. Looks like the onItemChanged (or whatever it is called) is not triggered. When do you set the value; before or after the dataset.onready?
That´s the correct way. Maybe Wix can shine some light on this, but I cannot escape the impression that you stumbled upon a shortcoming. I know for sure that a page without any changes is NOT saved (when using dataset and standard save/uoload button attached to ds) if you try to, so it looks like setting the default value for a field in code is not regarded as a change.
Maybe you (or someone else) sees some clue in the following. I had this in a totally different programming environment, but maybe Wix has it too. I haven’t a form yet so haven’t looked at it. Just my two cents. I took me in that situation at least 8 hours to figure it out.
My guess is that the ‘required’ is checked client side. I haven’t seen the required attribute on the tables. That would explain your require check is passing. I always also check server side (have to check later if Wix has that).
So then why is you default value not passed. In my situation the ‘onBlur’ of a field (leaving the field) triggered something where the code saw a change. So what I did was trigger the onBlur with a javascript command. I did see user input has a onBlur and onLeave. May chest triggering them in your code will help?
Hey Edgar, looks like we both suspect the problem to originate from the same source: front end checking governing back end behaviour. Let´s see what dmz comes up with as a workaround.
I prefill the “Recommended By” field with the logged in members name. Then I had been using the built in “submit” button but it would not “pickup” the filled in name. So I added the onClick for the button. It kind of works but I am still working on the code as the “required fields” do not give good feedback when not filled in with my code. But you should be able to reproduce what I was seeing. I definitely prefer using the “built in” submit button if I can…Thanks!
Ido, I have a quite complex form in which I worked around some behaviour of Saving. Your remark scares me, because maybe mine will break. Could you please elaborate on what you changed, so I can deduce if I have to test my work from scratch or not?
I ended up using the onClick() as I needed to get it done. It will be hard for me to go back and test as my onclick() has a bunch of error checking as well. I trust your testing and if I have to do it again, I will use the built in submit(). I am glad I actually found an issue and appreciate you folks fixing it…
Ido, thank you, that is relevant info for me, since I ran into a similar problem and kept track myself if a field was changed or not, thereby triggering a save or not. Back to testing.
Hi guys, I have looked everywhere on google for help with my form on my members page but I can’t find anything… Maybe you can help. Basically I have a coded members login page, with the update details page following (Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com) I have a form on the members login page which allows that particular member to upload details of their rental car vehicle which then automatically uploads onto a dynamic page to showcase that vehicle. My website is like Carsales but for rental cars which allows public to view cars for rent in their area.
The problem i’m having is when they upload their car details, i need their logo & company name…
When this member uploads the vehicle details in the database which showcases the vehicle on a dynamic page, how can I get their logo & company name to automatically get sent with their upload form. I’m thinking of having 2 hidden user inputs with prefill values of that particular members company name and logo but I don’t know how to do this?
(I’m not good with WiX code as of yet, only simple things)
@Ido, I’m having the same issue currently. Prepopulated day of the week field is not going through to the database. I just asked a question about it, on my own forum question. I didn’t understand the Wix answer given.
Hi Ido, I am having the same problem. Are the changes you made 2 years ago still applicable?
If it helps, there is one way I found for the save function to pick up the pre-filled field. That is to go to the pre-filled field and press any keyboard key (I usually just add a space after the last character).
Clearly this is not ideal. Any suggestions would be of great value. Thank you.
@oberdan Please add your own issue into a new post instead of bumping up an old post - Two years is forever in web development. What is it that you are trying to do? Explain what works, and what doesn’t. Also, add any code in a code block as stated in the Forum Guidelines .