top of page

Latest News

Mar 17, 2023

5 most promising Fintech startups

This is placeholder text. To change this content, double-click on the element and click Change Content.

Mar 21, 2023

Gadget review: release of new Airy Pods

This is placeholder text. To change this content, double-click on the element and click Change Content.

Mar 22, 2023

Best smart wearables of 2023

This is placeholder text. To change this content, double-click on the element and click Change Content.

Mar 19, 2023

How technology can help curb attention disorders

This is placeholder text. To change this content, double-click on the element and click Change Content.

Mar 18, 2023

Entering a new era of IoT

This is placeholder text. To change this content, double-click on the element and click Change Content.

Mar 20, 2023

Long-term benefits of clean energy sources

This is placeholder text. To change this content, double-click on the element and click Change Content.

Follow Us:
  • X
  • Instagram
  • White Facebook Icon

©2024 BRAHMA MEDIA LLC. Powered by Gozoek.com

Never miss an update
bottom of page
// Import the necessary Wix modules import wixData from 'wix-data'; import wixUsers from 'wix-users'; $w.onReady(function () { // Check if the current user is an admin wixUsers.currentUser.getRoles() .then((roles) => { const isAdmin = roles.some(role => role.name === "admin"); if (!isAdmin) { $w("#submitButton").disable(); $w("#errorMessage").text = "You do not have permission to add athletes."; } }); // Submit button click event with validation $w("#submitButton").onClick(() => { const name = $w("#nameInput").value; const age = Number($w("#ageInput").value); const sport = $w("#sportInput").value; const statistics = $w("#statisticsInput").value; const achievements = $w("#achievementsInput").value; const mediaCoverageLinks = $w("#mediaCoverageLinksInput").value.split(','); const photos = $w("#photosInput").value; const socialMediaLinks = $w("#socialMediaLinksInput").value.split(','); // Validation check if (!name || !age || !sport || !statistics || !achievements || mediaCoverageLinks.length === 0 || !photos || socialMediaLinks.length === 0) { $w("#errorMessage").text = "Please fill in all required fields."; return; } const newAthlete = { name: name, age: age, sport: sport, statistics: statistics, achievements: achievements, mediaCoverageLinks: mediaCoverageLinks, photos: photos, socialMediaLinks: socialMediaLinks }; wixData.insert("Athletes", newAthlete) .then(() => { $w("#successMessage").text = "Athlete added successfully!"; $w("#errorMessage").text = ""; // Clear error message }) .catch((err) => { console.error(err); $w("#errorMessage").text = "There was an error adding the athlete."; }); }); });