top of page

Forum Posts

Robert Gatt
Apr 13, 2023
In Coding with Velo
I have a form on a page which accepts user input, connected to a dataset called #dataset1. #dataset1 writes data to a Collection called Blocks Upon submit, that data is inserted correctly into the collection. Within the collection I have one column called BlockStatus that is a Reference Field. It is connected to another Table called StatusTable which contains 1 column called Status. StatusTable has just 2 records called Active and Inactive. I want that upon button submit (or before insert into the collection), "Active" is written to BlockStatus. How can I achieve this considering that BlockStatus column is a reference field?
0
4
45
Robert Gatt
Apr 11, 2023
In Coding with Velo
I have a dataset called #dynamicDataset that is connected to a collection called Accounts. The Accounts collection has 2 fields 'Amount' and 'Transaction Type'. I have a list repeater called #listrepeater that contains 3 fields. The first two fields are called #amount and #transactionType and are linked to #dynamicDataset. The 3rd field on #listrepeater is called #balance and is NOT connected to #dynamicDataset. The reason for this is that I want the #balance calculation to be calculated on the fly, every time the page loads. Below is my code. The first 2 fields (Amount, Transaction Type) are populated correctly on screen, and the balance is worked out correctly (when I put in some logs). The problem is that the value of balance is not showing up on the list repeater. In the below snippet I marked where the code is not doing what I want it to do. For clarity, if my collection contains 20 records, I need those 20 records to show up, and I need the balance to be calculated for each row, and the balance to show on screen for each record. $w.onReady(function () { let previousBalance = 0; $w('#listRepeater').onItemReady(($item, itemData, index) => { const amount = itemData.amount; const transactionType = itemData.transactionType; let calculatedBalance; if (transactionType === 'Debit') { calculatedBalance = amount - previousBalance; } else if (transactionType === 'Credit') { calculatedBalance = amount + previousBalance; } $item('#balance').text = calculatedBalance; <-- HELP! previousBalance = calculatedBalance; }); });
0
4
40
Robert Gatt
Apr 03, 2023
In Coding with Velo
I have a horizontal menu called HorizontalMenu1. I created a number of menu pages in HorizontalMenu1. They are called 1. MenuA, 2. MenuB 3. MenuC, I have set "MenuC" to Hide. I also have a login page. When I got to the public site URL I correctly see the site with MenuA and MenuB visible. Now, when I log in as a member of the site, I want MenuC to also show. How can I achieve this please? I assume I have to somehow access the menu page and call a .show() function upon login. Below is my login function. I can see that the array "item" contains only MenuA and MenuB when called. import wixUsers from 'wix-users'; import wixLocation from 'wix-location'; $w.onReady(function () { $w('#loginNow').onClick(function(){ let email = $w('#loginEmail').value; let password = $w('#loginPassword').value; wixUsers.login(email,password) .then(()=>{ wixLocation.to('/home'); }) }) let items = $w('#horizontalMenu1').menuItems; console.log("The menu items are: ", items); });
0
0
30

Robert Gatt

More actions
bottom of page