0

I'm trying to make a simple utility for my FAQ sections on a website. so far I have come up with a simple form that has 5 questions and 5 answers, and I am trying to grab the variables from each text box and insert them into the FAQ schema text, but I just can't figure it out.

This is what I have so far. I have tried using {} and @{} but it just displays them as text. I have written this already in PowerShell with winforms, but I find PowerShell much easier to use.

<!DOCTYPE html>  
<html>  
<head>  
<title>Output Tag</title> 
</head>  
<body>  
 <p>FAQ Schema Creator</p>
 <form onInput='faq.value="[sc_fs_multi_faq headline-1=\"h4\" question-1=\"q1.value\" answer-1=\"a1.value\" headline-2=\"h4\" question-2=\"a2.value\" answer-2=\"\" headline-3=\"h4\" question-3=\"\" answer-3=\"\" headline-4=\"h4\" question-4=\"\" answer-4=\"\" headline-5=\"h4\" question-5=\"\" answer-5=\"\" \"count=\"5\" html=\"true\" css_class=\"\"]"'>
      
  <label for="fname">Question 1:</label>
  <input type="text" id="q1" name="q1">
  <label for="lname">Answer 1:</label>
  <input type="text" id="a1" name="a1"><br>
<br>
  <label for="fname">Question 2:</label>
  <input type="text" id="q2" name="q2">
  <label for="lname">Answer 2:</label>
  <input type="text" id="a2" name="a2"><br>
<br>
<label for="fname">Question 3:</label>
  <input type="text" id="q3" name="q3"> 
  <label for="lname">Answer 3:</label> 
  <input type="text" id="a3" name="a3"><br>
  <br>
<label for="fname">Question 4:</label> 
  <input type="text" id="q4" name="q4"> 
  <label for="lname">Answer 4:</label> 
  <input type="text" id="a4" name="a4"><br>
  <br>
<label for="fname">Question 5:</label> 
  <input type="text" id="q5" name="q5">
  <label for="lname">Answer 5:</label> 
  <input type="text" id="a5" name="a5"><br><br>
 
Output is:<br><output name="faq"></output>
 
</form>
</body>  
</html> 

1 Answer 1

1

Try separating the string from the formvalues by replacing question-1="q1.value" with question-1=""+q1.value+"". Note the extra "+ and +". Like so:

<!DOCTYPE html>  
<html>  
<head>  
<title>Output Tag</title> 
</head>  
<body>  
 <p>FAQ Schema Creator</p>
 <form onInput='faq.value="[sc_fs_multi_faq headline-1=\"h4\" question-1=\""+q1.value+"\" answer-1=\""+a1.value+"\" headline-2=\"h4\" question-2=\""+a2.value+"\" answer-2=\"\" headline-3=\"h4\" question-3=\"\" answer-3=\"\" headline-4=\"h4\" question-4=\"\" answer-4=\"\" headline-5=\"h4\" question-5=\"\" answer-5=\"\" \"count=\"5\" html=\"true\" css_class=\"\"]"'>
      
  <label for="fname">Question 1:</label>
  <input type="text" id="q1" name="q1">
  <label for="lname">Answer 1:</label>
  <input type="text" id="a1" name="a1"><br>
<br>
  <label for="fname">Question 2:</label>
  <input type="text" id="q2" name="q2">
  <label for="lname">Answer 2:</label>
  <input type="text" id="a2" name="a2"><br>
<br>
<label for="fname">Question 3:</label>
  <input type="text" id="q3" name="q3"> 
  <label for="lname">Answer 3:</label> 
  <input type="text" id="a3" name="a3"><br>
  <br>
<label for="fname">Question 4:</label> 
  <input type="text" id="q4" name="q4"> 
  <label for="lname">Answer 4:</label> 
  <input type="text" id="a4" name="a4"><br>
  <br>
<label for="fname">Question 5:</label> 
  <input type="text" id="q5" name="q5">
  <label for="lname">Answer 5:</label> 
  <input type="text" id="a5" name="a5"><br><br>
 
Output is:<br><output name="faq"></output>
 
</form>
</body>  
</html> 

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.