Hello there everyone.
Anyone knows how to use this —> $item (“#repeatedElement”)
$w("#myRepeater").forEachItem( ($item, itemData, index) => {
let repeatedElement = $item("#repeatedElement");
let nonRepeatedElement = $w("#nonRepeatedElement");
let itemDataValue = itemData.someProperty;
let isEvenItem = index % 2 === 0;
} );
I need to get the value of an element in my repeater. Let’s say the value of a radio button.
Below you can see all of the details coming from $item(“#repeatedElement”)

When I tried $item(“#repeatedElement”).value, it didn’t show the value in the console
Hope anyone could help me with this.
Thanks a lot!
These examples show how to use input elements in a Repeater:
Thank you, Yisrael… It’s not working a while ago because I noticed there’re no values on my radio buttons. But now it’s working because I tried to put values into it.
Thank you very much for your time. 
Hello again, @yisrael-wix . Just want to ask… After onClick, I made the console to show the values of my radio button from my repeater, and you can see in the picture below that I have 9 items in my repeater. My question is, how can I grab those 9 values from the radio button in the repeater, and make it one string like this… c a d c b a b d a?

@aeroengineerz7 Just concatenate the values into one long string…
let str = va1 + ’ ’ + val2 + ’ ’ + val3 + … and so on for all 9 values
@yisrael-wix
Actually, I’m planning to make it like that, but then, I can’t separate them.
So my code is this…
$w( “#rptr” ).forEachItem(($item)=>{
$w( “#submit” ).onClick(()=>{
console.log($item( “#radioButton” ).value);
})
})
Is there any code for the repeater something like in finding some results from a query that is similar to the code below, so that I could separate all of the 9 values of the radio button coming from the repeater?
wixData.query(“Database”)
.find()
.then((res)=>{
let firstItem = res.items[ 0 ];
let secondItem = res.items[ 1 ];
let thirdItem = res.items[ 2 ];
})
@aeroengineerz7 Sorry, but I don’t understand what you have. What does your repeater item look like? What are the elements in the repeater item? What does the radio button look like? How many options? What does a database query have to do with getting the results from your radio button?
You will need to provide more information.
@yisrael-wix I have 4 options in my radio button and 9 items shown in my repeater. There’s a description as well above the radio button something like a question, and the user will choose which is the best answer among the four choices.
Here’s the code
wixData.query( “DatabaseName” )
.limit( 9 )
.find()
.then((result)=>{
$w( “#rptr” ).data = result.items;
$w( " #rptr " ).forEachItem(($item)=>{
let getCItem = $item( “#dataset” ).getCurrentItem();
$item( “#choices” ).options = [
{ “label” : getCItem.a, “value” : “a” },
{ “label” : getCItem.b, “value” : “b” },
{ “label” : getCItem.c, “value” : “c” },
{ “label” : getCItem.d, “value” : “d” }
];
$item( “#description” ).text = getCItem.qs;
$w( " [#submit](https://www.wix.com/velo/forum/search/~num~submit) " ).onClick(()=>{
console.log($item( " [#radioButton](https://www.wix.com/velo/forum/search/~num~radioButton) " ).value);
})
})
})
@aeroengineerz7
You should better give a screenshot of your DB and your repeater.
So everybody can understand your issue better, if you want to get some answers.
@russian-dima Thanks for replying…
So after the user chose his answer then clicks submit, the code will get the values of each radio button in this format —> b a c.
By the way, I already know how to make each radio button’s values become “a b c d”.
You can save all the answers in an array and then do what you want with them after you “collect” them all.
let answers = [];
$w("#rptr").forEachItem(($item)=>{
$w("#submit").onClick(()=>{
console.log($item("#radioButton").value);
let answer = $item("#radioButton").value;
answers.push(answer);
})
})
// all the answers are now available in the answers array
console.log('all answers', answers);
I already tried your code and this what happens… Still didn’t join with each other.

@aeroengineerz7 What do you mean by “didn’t join with each other”? You should have an array of 9 values that you can then use in a string, or whatever else it is you want to do.
As you can see in the last picture I sent, a b c are in different rows which means they are separated with each other. I’m expecting it to be in one row only which means I can grab them as one string. When I tried your code and make it to show in the page, the only letter that is showing is the last letter, so if the result is this… b d c, I would see in the page is the letter c only, and not “b c d” .
For now, I made it 3 and not 9 just to make it clear.
@aeroengineerz7 I’m sorry, but apparently I just don’t understand what you are trying to do.
The code snippet that I posted was an example of how you can collect data from different Repeater items. Please realize that you can’t just “copy and paste” code and expect it to work. You need to understand what’s happening if you expect to be able to write code that does what you want.
You can use my example code and adapt it to your own needs. Use the Repeater’s forEachItem() function to loop through all of the repeater items, and “collect” the data along the way. After the data has been collected, you can then use it as you wish.
@yisrael-wix What I’m trying to do is this…
The current user of the page will answer all of the questions in the repeater by choosing from the radio buttons.
Example:
-
Question 1
a. By clicking this radio button, the user chooses a
b. By clicking this radio button, the user chooses b
c. By clicking this radio button, the user chooses c
d. By clicking this radio button, the user chooses d
-
Question 2
a. By clicking this radio button, the user chooses a
b. By clicking this radio button, the user chooses b
c. By clicking this radio button, the user chooses c
d. By clicking this radio button, the user chooses d
and so on…
Then after clicking the submit button, I would be able to get the user’s answers for each question in string format and it is something like this… —> “a c b b c a”.
@aeroengineerz7 OK, so you should be able to use the code that I supplied. Just take all of the answers in the array and put them into a string:
let answerStr = answers[0] + ' ' + answers[1] + ' ' answers[2] + ...
Or you can build the string in a loop - whatever works best for you.
@yisrael-wix Sorry for disturbing you… I really appreciate your help.
let answers = ;
$w( “#submit” ).onClick(()=>{
let answer = $item( “#choices” ).value;
answers.push(answer);
console.log(answers[ 0 ] + " " + answers[ 1 ] + " " + answers[ 2 ])
})
The result is this… 
