members email linked to repeater

I have a repeater showing member details associated with a web site. The details in the repeater list are linked to a database. I want to connect an email in the database to a button in the repeater. I can link the member image, name and bio to the database no problems but I can’t get the button to connect to the email field in the database. The button has a link property but that only allows for manual entry of the email address. The button also has the connection to the database but all of the fields are greyed out so I can’t select them.

How do I do this?

What I want to do is allow visitors to email any of the members listed by clicking an email link button in each members profile.

Hi,

Use simple code to set the button link to be one that opens the default email application on the computer.
The code should be in ’ onItemReady ’ handler.

export function repeater1_itemReady($w, itemData, index) {
    $w('#button1').link = 'mailto:' + itemData.email;
}

Liran.

I am not a coder but want to accomplish the same thing.
In this code does “mailto:” refer to the column label that holds the email address?
Can you provide more details for someone who is completely lost?

Hi,
In order to send an Email, you use the " mailto: " with the mail address. The column name should be " email " (you need to make sure that this is how you set your collection).

Good luck,
Tal.

1 Like

got it all working. Thanks Tal.

Hi, let’s say I have 300 members in my website and I want everytime people click the ‘WhatsApp Me’ Button, they will be able to contact the members’ phone numbers (from database), not mine.

The 300 members profile info will be shown to the public visitors through a ‘REPEATER’. So there is a ‘WhatsApp Me’ button IN EACH OF THEIR PROFILE that enable visitors to WhatsApp any of the 300+ numbers .

What I wanted to is to extract all ‘their’ numbers from my database and link them a constant url (which is ['https://wa.me/(their]('https://wa.me/(their) phonenumber)

Sorry really new to all this…
Can you maybe please show me a line of code that can extract their phone numbers from the database and put it behind the constant ‘https://wa.me/(theirphoneno)’ url

Thanks! Been asking this everywhere for 2 weeks now but didnt get answer on how to write the code…thank you guys

Hi, it is very similar to the above email examples. you need to user code to add the right link property to the WhatsApp Me button.

so in the inside the $w onready function you should put something like that

$w( “#” ).onItemReady( function ($w, itemData, index) { $w( ‘#’ ).link = ‘https://wa.me/’ + itemData.phones[ 0 ]; })

of course you should check that there is a phone number in the collection…

@avigu hi can you please check if i do it right with my code here. I have two main things that needed to work here the search bar and the whatsapp button. The search bar was working fine but after i added this extra line of code it stop working. And the WhatsApp function I tried to achieve with this code also didnt succesful. Sorry, I didnt have any previous experience in this area. Thank you:

import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;

$w.onReady( function () {

});

export function searchBar_keyPress(event, $w) {
let SearchValue = $w( “#searchBar” ).value;
$w( ‘#dataset1’ ).setFilter(wixData.filter().contains( ‘daerah’ , SearchValue));

} 

$w.onReady(() => {

$w(“#dataset1”).onReady(() => {
$w(“#repeater1”).onItemReady(($item, itemData, index) => {

export function image2_keyPress(event, $w) {

let phone = $w(“#text548”).text;
let link = “https://wa.me/” + phone;

wixLocation.to (‘link’)

}

@lionbrainstudio

Please follow our forum guidelines and don’t post in the forum on 27th April and get replies and then bump up an old thread with the exact same issue.
https://www.wix.com/corvid/forum/community-discussion/add-different-phone-numbers-from-database-to-constant-whatsapp-url?origin=member_posts_page

https://www.wix.com/corvid/forum/community-discussion/corvid-community-guidelines
No Thread Hijacking. Don’t post about an issue and then bump other threads with your issue.

This old post from 2018 is being closed.