Background:
In a repeater I have a text field (text6) connected to a database (userStatus), this shows a users status. I also have a user input field (input1) which is connected to a different database (Comments).
What i want it to do:
I want what text6 shows from the database to be copied to input1 as a user input when a user clicks on a text box (textbox1).
The Problem:
Text6 shows the information from the database but this isnt copied to input1, instead the original text (from the editor) is copied.
Heres some pics to help - elements i am talking about are highlighted in green.
@firstplacevape In your opening post you said #text6 was in a repeater. So is it or isn’t it? If it is I think your code is wrong and givemeawhisky’s first link explains why.
@lee1 Yes it is in a repeater, maybe he is right tbh im new to this coding side and im still wrapping my head around it, ill check it out again and see what i can make of it
@firstplacevape This might be what you’re looking for. It’s hard to be sure about how the elements you’ve mentioned relate to one another. Again, the link above explains selector scope.
You can use .at selector
to select a specific instance in a repeater and connnect with it
One was using $w at
export function textBox1_click(e) {
let $item = $w.at(e.context);
let user = $item('#dataset1').getCurrentItem();
$item ('#input1').value = user.userName;
}
second way using forEach Loop
$w('#repeater').onItemReady(($item, itemData, i)=>{
let user = $item('#dataset1').getCurrentItem();
$item ('#input1').value = user.userName;
});