I have been trying to achieve this for the past week but I am on the verge of giving up! So in need of help PLEASE! Thank you
I have a repeater on my page that I connected to a dataset by code.
The container in the repeater has three elements:
a text for the name, a text for an email, and a button.
The email and the name texts come from the dataset.
On the page, I have an empty user input element, a text box.
I added a function button in the repeater so that every time I click on the corresponding button of a container in the repeater the email of that container gets added to the text box so I can send a mass email to all the recipients in that text box.
I was successful in connecting the elements of the repeater to the dataset.
And I was also semi-successful in adding the email address from the repeater to the text box by creating an onClick function that adds the email to the text box. BUT (and here where the problem is), it is only doing so for the FIRST container in the repeater whereby if you click any of the buttons in the repeater, the value of the text box will be equal to the value of the first email of the first container.
I know this might be complicated, so THANK YOU in advance for any help or advice.
import wixData from ‘wix-data’;
$w.onReady( function () {
});
$w.onReady( function () {
$w(“#repeater1”).onItemReady( ($w, itemData, index) => {
$w(“#text113”).text = itemData.email;
$w(“#text111”).text = itemData.givenName;
$w(“#text112”).text = itemData.practiceAreas;
} );
wixData.query(“CommunityMembers”)
.find()
.then( (results) => {
$w(“#repeater1”).data = results.items;
} );
} );
function emailCombine () {
$w(“#textBox1”).value = $w(“#text113”).text;
}
export function button1_click(event, $w) {
emailCombine ();
}