@Wix - Is there a way to code an onChange handler of say, a dropdown to submit user details to the db without having to add an additional ‘submit’ button?
You should be able to do this using the wix-data insert function.
Many thanks Sam!
Is there a way to make this work so that the onChange handler of the dropdown clicks the button…?
export function dropdown_change(event) {
//other function
//other function
//other function
//other function
//other function
//other function
//other function
$w(‘#button1’).click();
}
Can you describe why you’d want to do that?
Sure. I’ve currently got button1 connected to the submit function of a db, which sends an email on aftersave. I find this too complex (for my current coding skills) to rewrite all the code so that it still sends the email if the dropdown changes
Guess what I’m saying is that all the functionality is already there, it would be very easy if I could simply have the button clicked every time the dropdown changes
You could just do the submit (a save() in the wix-dataset API) in the code of the dropdown change. The aftersave you’ve already written will still be called.