I have this code, for a text string that includes a field. When i preview i can read the collection field name but the Hello and how are you parts are not shown?
$w('#text109').text='Hello ${Name} how are you?';
What have i missed?
Thanks
Adam
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
this might be easier to see than downloading the screen shot
There was an error in your script
TypeError: undefined is not a function (near '...$w.OnReady...')
ok almost there, the parsing error has disappeared but now seems to be an issue with
I am thick, as missed })
but the the name is showing as undefined and i have taken this from the field key in the collection, i have underlined Name as showing as undefined
$w.OnReady(() => { $w("#dynamicDataset").onReady(() => { const name = $w("#dynamicDataset").getCurrentItem().name;//use your field key $w('#text109').text = `Hello ${Name} how are you?`; }) })
literally just show this string on a dynamic page, the Hello bit is already contained in the text element and the ${Name} is found in the collection that's linked to the dataset
Thanks J.D. silly question but should i connect this to the dataset?
Ok thanks, i've learnt something new so how should the above look without causing a parsing error please?
You're using ' instead of `