top of page

Forum Posts

aegrasty
Feb 28, 2019
In Coding with Velo
Hello Wix Fam! I could use some help. I am working with two check boxes for a "yes/no" response in a custom form. I want to disable one option if the other is selected. I can't seem to get the code working even though this seems like such a simple task! I have listed the code below. Any help would be appreciated. NOTE: I chose not to use radio buttons because 1) I wanted more freedom with customization and 2) I have an "onClick" event to show collapsed fields that wouldn't have been feasible with the radio button. export function disableCheckBox() { let isChecked = $w("#physicalAddressYes").checked; if ($w('#physicalAddressYes').checked === true) { $w('#physicalAddressNo').disable(); } else { $w('#physicalAddressNo').enable(); } } export function physicalAddressYes_click(event) { displayAddressInput(); }
1
1
934
aegrasty
Jan 30, 2019
In Coding with Velo
Hello everyone! I have been diving deeper into the wix-fetch API so that I can use 3rd party services in some of my website functionality. I have designed a landing page for a client and that will be used to capture referral form data. I have been able to leverage the Wix Code Tutorial: Sending an Email on Form Submission to successful setup API integration, However, I would like to make the design a bit more professional that the plain-text option. I was thinking I could do this through Transactional Templates. I have followed the steps and within Sending Template Emails with SendGrid V3 but am still having trouble. Nothing occurs. No email is generated or sent. My code snippets are below. Can anyone spot what I am missing? //email.jsw import {sendInstruction} from 'backend/sendGrid'; export function sendEmail(subject, body, Recipient) { const key = "XXXXXXXAPIKEYXXXXXXXXXXX"; const sender = "recipientEmailHere"; return sendInstruction(key, sender, Recipient, subject, body); } //sendGrid.js export function SendInstruction(key, sender, RecipientEmail, subject, body) { const url = "https://api.sendgrid.com/v3/mail/send"; const MyHeaders = { "Authorization": "Bearer " + key, "Content-Type": "application/json" }; const MyBody = { "personalizations": [{ "to": [{ "email": RecipientEmail }] }], "from": { "email": sender }, "subject": subject, "content": [{ "type": "text/html", "value": body }], "template_id" : "d-9ccb08ff65b3405b82f430ee3f6e5014" }; return fetch(url, { "method": "POST", "headers": MyHeaders, "body": JSON.stringify(MyBody) }) .then(Response => Response.text); } Page Code import {sendEmail} from 'backend/email'; function SendClientEmail() { const Subject = `New Submission from ${$w("#firstNameInput").value}`; const body = `Name: ${$w("#firstNameInput").value} \rEmail: ${$w("#referralEmailInput").value}`; const RecipientEmail = 'recipientEmail'; sendEmail(Subject, body, RecipientEmail) .then(response => console.log(response)); } There may be a lot of issues here but any assistance would be great!
1
8
1k

aegrasty

More actions
bottom of page