Hello,
I am working on the review/comments feature of my website and I would like to know how to display the text “I recommend” in the repeater based on the value from the dataset.
There is a form that allows customers to input this information into the dataset. For this, I used radio buttons “I recommend” = True ; " I do not recommend" = False. The field type in the dataset is set to boolean.
The problem is that when someone leaves a review, the value in the dataset does not populate as “True” or “False.” Instead, there is a weird code and I have to manually convert it so the correct value shows on the repeater. In the meantime, “I recommend” displays on the repeater regardless of whether the customer recommends.
How can I get the radio value to populate into the boolean field correctly? I am open to suggestions.
The code I am using is below:
$w.onReady( function () {
$w(‘#dataset1’).onReady( () => {
$w(‘#repeater1’).forEachItem( ($w, itemData, index) => {
if (itemData.recommended){
$w(‘#recommendation’).text = “I recommend this product.”;
}
else {
$w(‘#recommendation’).text = " ";
}
} );
} );
} );
Thank you for all your help!