如何使用JavaScript更改HTML中的Blask WTForm字段值?
我有一个简单的隐藏字段,以html形式:
< input type =“ hidend” id =“ wenspy” name =“ wances”> {{form.Response}}</div>
我想更改其值,以便我可以在以后使用烧瓶和wtforms使用它。
我尝试了一下:
function(token){
document.getElementById('response').value = token
}
函数被带有有效的令牌,但没有成功。
有什么建议吗?
I have this simple hidden field in an HTML form:
<input type="hidden" id="response" name="response">{{ form.response}}</div>
and I want to change the it's value so that I can use it using flask and WTForms later on.
I tried this:
function(token){
document.getElementById('response').value = token
}
and the function is being called with a valid token, but no success.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
形式的输入字段如下创建,其中可能的其他参数(例如标签或验证器)。
需要以下代码在服务器端请求值。
如果您现在在模板中渲染,则自动设置属性名称和ID。该值对应于分配输入字段的变量的标识符。要查询并设置值,您可以使用具有名称属性的选择器或输入字段的ID。
The input field for a form is created as follows, where additional arguments like a label or validators are possible.
The following code is required to request the value on the server side.
If you now render within the template, the attributes name and id are set automatically. The value corresponds to the identifier of the variable to which the input field was assigned. To query and set the value, you can either use a selector with the name attribute or the id of the input field.