Hi
This is my page :
![](https://static.wixstatic.com/media/a27d24_9e86794a8f674341bcab23372e446c18~mv2.png/v1/fill/w_49,h_28,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_9e86794a8f674341bcab23372e446c18~mv2.png)
and here is the code behind this page:
import wixData from 'wix-data'; export function save() { // wixData.query('Artistes') .eq('title', $w('#input14').value) .find() .then(res => { let firstItem = res.items[0]; let toInsert = { "artiste": firstItem._id, "inputArtist": $w("#input14").value, "title": $w("#input11").value, "annee": $w("#input9").value, "languePrincipale": $w("#input10").value, "duo": $w("#input12").value, "live": $w("#input13").value }; console.log(toInsert); wixData.insert("Titres", toInsert) .then((results) => { console.log(results); }) .catch((err) => { console.log(err); }); }); }
When I fill in my form and validate, it works very well, except that it leaves the validated data displayed. (However, they are correctly entered in the database)
Which code should I add (and where? (I am a beginner))) so that when I validate, the form becomes blank again.
Thanks in advance for your help
I can't seem to open this image from the forum, kindly send it to me at tiaan@wix-coders.com
I replace the commas, but same error :
Looks fine, I would just remove the commas and replace it with ';'
Thanks, but don't work.... Where Am I Wrong ?
import wixData from 'wix-data'; export function save() { // wixData.query('Artistes') .eq('title', $w('#input14').value) .find() .then(res => { let firstItem = res.items[0]; let toInsert = { "artiste": firstItem._id, "inputArtist": $w("#input14").value, "title": $w("#input11").value, "annee": $w("#input9").value, "languePrincipale": $w("#input10").value, "duo": $w("#input12").value, "live": $w("#input13").value }; console.log(toInsert); wixData.insert("Titres", toInsert) .then((results) => { $w("#input14").value = "", $w("#input11").value = "", $w("#input9").value = "", $w("#input10").value = "", $w("#input12").value = "", $w("#input13").value = "" }; console.log(results); }) .catch((err) => { console.log(err); }); }); }
Hi Karl
in your '.then(())=>{ IN HERE } after the values have been inserted in the database, simply set your input fields value to nothing like this:
$w("#input1").value = "";
Tiaan
Up