Hi, I have a code on one of the pages of my wedding website that was working on desktop but not on mobile. I've been trying to make changes to it to get the published mobile site to work but don't have any luck. Also, it has now seemed to stop working for the published desktop site as well. It all works on the preview modes, both desktop and mobile.
Guests should be able to type in their full names and click the "Find My Invitation" button and have the box expand once entered, but the "find my invitation" button doesn't work on desktop or mobile once published.
This is the code:
import wixLocation from 'wix-location'; import wixData from 'wix-data'; var number = 0; var family = " "; $w.onReady(function () { $w("#box1").collapse(); $w("#errortext").hide(); $w("#submittext").hide(); $w("#table1").hide(); }); export function button10_click(event) { //find my invitation button $w('#box1').collapse(); $w('#errortext').hide(); for (var i = 1; i < 6; i++) { var q = i; var identifier = "#name" + q; $w(identifier).collapse(); identifier = "#selectionTags" + q; $w(identifier).collapse(); } var name = $w('#nameinput').value; $w('#nameinput').value = name wixData.query("responses") //responsesdatabase .contains("name", name) .find() .then((res) => { if (res.items.length == 1) { $w("#errortext").text = "You or someone in your party has already submitted an RSVP. Thank you!"; $w("#errortext").show(); } else { wixData.query("GuestList") //check for firstname matches .eq("fullName", name) .find() .then((res) => { if (res.items.length > 0) { let firstItem = res.items[0]; //First item in results $w('#box1').expand(); //$w("#submittext").hide(); number = firstItem.guestNumbers; family = firstItem.family; //family name identifies party if (number == 1) { //if only one guest $w('#text2').text = "We have reserved one seat in your honour." $w('#name1').expand(); $w('#name1').text = name; $w('#selectionTags1').expand(); } else { //if multiple guests $w('#text2').text = "We have reserved " + number + " seats in your honour." wixData.query("GuestList") //find # of people w family name .eq("family", family) .find() .then((res) => { //$w("#submittext").hide(); //fill in each name in rsvp section for (let i = 0; i < number; i++) { var q = i + 1; var identifier = "#selectionTags" + q; $w(identifier).expand(); var identifier = "#name" + q; $w(identifier).text = res.items[i].fullName; $w(identifier).expand(); } }); } } else { $w('#errortext').text = "Please try again, or contact the couple for help."; $w('#errortext').show(); } }); } }); } export function button2_click(event) { $w("#button2").disable(); //$w("#group1").expand(); for (var i = 0; i < number; i++) { //add to database var q = i + 1; var identifier = "#name" + q; var name = $w(identifier).text; let tag = "#selectionTags" + q; if ($w(tag).selectedIndices[0] == 0) { //accept //add to database let toInsert = { "name": name, "rsvp": "Yes", "hotel": $w('#textBox1').value, "song": $w('#textBox2').value }; wixData.insert("responses", toInsert) .then((results) => { $w("#submittext").show(); }) .catch((err) => { let errorMsg = err; }); } else if ($w(tag).selectedIndices[0] == 1) { //decline let toInsert = { "name": name, "rsvp": "No" }; wixData.insert("responses", toInsert) .then((results) => { $w("#submittext").show(); }) .catch((err) => { let errorMsg = err; }); } } }
Published Mode:
![](https://static.wixstatic.com/media/4ee9f2_7b5094a9cde4441dab4a457c949f66f5~mv2.png/v1/fill/w_49,h_28,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4ee9f2_7b5094a9cde4441dab4a457c949f66f5~mv2.png)
Edit Mode:
![](https://static.wixstatic.com/media/4ee9f2_e5ea334697814b87b39ddf51aeaeb5a7~mv2.png/v1/fill/w_49,h_28,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4ee9f2_e5ea334697814b87b39ddf51aeaeb5a7~mv2.png)
If your code to search the collection for an invitation works in preview but not live, I would suggest checking the collection permissions.