I got one of my questions here for an end-user response when the answer to the question is not on the list. I achieved this by using the folllowing snatched from this post
<%*
let choice = tp.system.suggester(['Yes','No','User Defined'],['Yes','No','User Defined']);
if (choice == 'User Defined')
{
choice = tp.system.prompt('Other choice');
}
-%>
What I can not figure out for the life of me is how to have the question show up on the prompt for the answer. As it sits now I receive a suggester asking for the answer "âYesâ,âNoâ,âUser Definedâ. What i would like to figure out is how to have the question show up so i know what question I am answering. What it comes down to is can not figure out the context for nesting the tp.system.suggester with in the tp.system.prompt.
your snippet helped a ton. Thank you. I had read that lined documentation but your example helped me understand it better. The issue is now when I use your snippet and answer the question of âWhatâ, the answer does not appear at all just a blank note. Thank you for helping out a new guy. Very Thankful.
OK now to add to this question. How do I ask multiple questions in the same template? The snippet above works but as soon as I duplicate it and ask the second question âWhereâ I get the following error:
plugin:templater-obsidian:61 Templater Error: Template parsing error, aborting.
Template syntax error: Identifier âquestionâ has already been declared
I realize this might be a basic issue but very thankful for your assistance.
I will admit I am new to this but trying to learn as I go and will be trying to dig into some javascript classes soon. This is what I have and am confused about your last response" and give it a new value similar to that when re-suing the choice variable,"
Venue:
<%*
let question = "Venue?"
let choice = tp.system.suggester(['home','office','User Defined'],['home','office','User Defined'], false, question);
if (choice == 'User Defined')
{
choice = tp.system.prompt(question1);
}
-%>
`<% choice %>`.
Worked:
<%*
let question = "Worked?"
let choice = tp.system.suggester(['YES','NO','User Defined'],['YES','NO','User Defined'], false, question);
if (choice == 'User Defined')
{
choice = tp.system.prompt(question);
}
-%>
`<% choice %>`.
That worked, so if you declare it as âletâ then that will allow for each expression with âquestionâ to be unique for the entire block. Correct? Thank you for all your help!
for the future this is the code that worked: