我有一个简单的任务!我希望在提交表单并获得表单的成功或错误消息时,直接转到表单(使用锚点),为此,我在from action的URL中添加了一个parametr,如下所示: action="%%url%%?form-submitted=true" 当表单提交时,我编写了以下代码: // This script is for moving the page to the form is the page is loaded by submitting the form
let pageUrl = window.location.href;
let url = new URL(
假设我有一个用于创建动物(名称、颜色……)的表单,如何访问输入值并在同一表单页面中显示它(在表单提交之后)。
我试过了:
class AnimalCreate(CreateView):
model = Animal
form_class = AnimalForm
success_url = 'main_site/success.html'
def get_context_data(self, **kwargs):
color = ?? # how to get the value of the color input ?
context = su