title basically sums it up but, I want to click a button in a Repeater and have a fieldkey in one of my data sets be added to the link that the button goes to. I’m new at coding on Wix so i apologize if my code is wayyyy off and or the Title
this seems to work kinda but only once and only for the first listing in the repeater
import wixData from ‘wix-data’;
export function carfax_click(event, $w) {
carfaxUrl();
}
function carfaxUrl (){
let vin = $w(‘#Vin’).text;
$w(“#carfax”).link = (“CARFAX - Unavailable” + vin)
$w(“#carfax”).target = “_blank”;
}
“vin” in this case is a cars vin number so that once its added it would go to that cars carfax page
Also: If some could show me the code to make a range slider with new slides that filters the repeater based on the range of number fieldkeys
Okay well definitely is helpful to know that i need to use that, But I’m still so confused i have nor idea how to set this up this is the mess i came up with
in the scope of the onItemReady() function, you should use $item when you refer to a repeater item. don’t use $w .
That includes the elements in the onClick() function (and also $w(“#Vin”) should be $item(“#Vin”) if it is a repeater item.)
But I also need it to open in a new tab, which i now know you have to use .target to do, I haven’t been able to figure it out here were the ideas I had:
If you push a link to a button, you don’t need onClick() at all, because links automatically react to clicks. So you have 2 options: 1. Use the link property without onClick() and without wixLocation; 2. Use onClick() + wixLocation.to() without the button.link.
(if you want the target to be “_blank”, you need to go for option1).