How to refresh a input box

|p2>[=
[##(inputbox:2bind $answ ,“x”,1)]<input|
(move:$answ into $answer)
(link:“SUBMIT”)[(rerun:?p2)]

Please use the comment field’s Preformatted text </> toolbar option when including a code example in your comments, it makes the code easier to read & copy, and stops the forum’s software from converting valid Standard quotes into invalid Typographical (curvy) quotes.

It’s a little unclear what you mean by “refresh”, I will assume you mean how to reset the value of $answ so that the input box appears ‘empty’ after the SUBMIT link is selected.

The following variation of your example uses the forth argument of the (input-box:) macro to assign an Empty String as the default value to the $answ variable, it also changes the 2bind to a bind so that the macro doesn’t replace the assigned Empty String isn’t a numerical Zero.

(set: $answer to "")\
|p2>[=
[##(inputbox: bind $answ, "x", 1, "")]<input|
(link: "SUBMIT")[
	(move: $answ into $answer)
	(rerun: ?p2)
]

You will notice I made a couple of other changes to your original example:

  1. I assign the $answer variable a default value.
  2. I moved your (move:) macro call to be within the associated hook of the link, so that the inputted value contained within the $answ variable will be assigned to the $answer variable.
  3. I have used Escaped line break markup to suppress the line-break at the end of the (set:) macro call.