Please provide a link to your site or the full code you’re using in your site.
One of us, the WixCode team, will look into it and provide you with a solution.
I’m trying to copy fields “Child name” and “Child ID” from hidden paragraph field. Filling the input fields works fine with my custom written javascript but the field is never saved in the database.
I spent hours trying to figure this out, looks like something on the wix backend prevents this (likely to prevent DDOS type stuff) but i did find a workaround that worked for me:
My application is trying to set a unique code to link user inputs to the user. It doesn’t have to be structured or super unique so I just set the before insert hook code:
var uniqueCounter = new Date()
uniqueCounter = “text” + Math.ceil(uniqueCounter.getTime() / 100); //converting to string format
basically I’m presuming I won’t have 100 form submissions per second.
This is then tied to the user submission via session variables that are updated as the user types in data into the fields.
export function emailAddress_change(event) {
//Add your code for this event here: var ymm = $w(“#yearMakeModel”).value; var ig = $w(“#igHandle”).value; var em = $w(“#emailAddress”).value;
session.setItem(“ymm”, ymm);
session.setItem(“ig”,ig);
session.setItem(“em”,em);
}
Once the user hits my landing page the landing page on ready searches the database for the exact match of 3 of the form fields and then sets the unique code.
you might be able to:
Store the childName and ID to a session variable then
After form submit once the user hits the landing page do a database update based on finding the previously submitted data and then updating it?
I tried using session variables in the backend before and after update to no success.
I tried to auto-increment a database column on form submission to no success.
I’d be really curious of a Wix Support answer…seems silly to not allow data to be entered into the database if it was programatically filled in to the field.
Hi,
If an element is connected to a dataset, setting the element’s value in code does not set the value of the connected field in the dataset. That means if you use the dataset to perform a submit, the value changed in code is not reflected in the submitted item.
To submit the new value using a dataset, set the field’s value using the setFieldValue() function before performing the submit.