提交后如何不清除或重置表单?

时间:2021-08-01 10:31:27

标签: html flask

我有一个表单,可以让用户输入一些内容并返回输出。我不想在结果返回到此页面后清除用户的输入。

<form action="{{url_for('predict')}}" method="post">
     <label for="resource_id">Resource id</label>
     <input type="text" name="resource_id" id="resource_id">
     <label for="topic">Topic</label>
     <input type="text" name="topic" id="topic"> <br>
     <label for="discussion_text">Discussion</label>
     <textarea rows="5" cols="80" id="discussion_text" name="discussion_text"></textarea>
     <button type="submit" onclick="return False">Predict</button>
</form>

我查看了其他帖子,并尝试将 onclick="return False" 添加到 <button type> 并将 onSubmit="return False" 添加到 <form>,但都不起作用。我该如何解决?谢谢!

0 个答案:

没有答案