如何使用POST表单和Flask中的<a>链接到另一个页面[已解决]

破布
<div class="dropdown">
    <button class="dropbtn"><h2>Please select your device <i class="fa fa-caret-down"></i></h2> </button>

    <div class="dropdown-content">
        {% for n in range(devicesFiles|length) %}
        <form action={{url_for("annotator")}} method='POST'>
        <a name="deviceID"> {{devicesFiles[n]}} </a></form>
        {% endfor %}
    </div>
</div>


@app.route("/annotator/", methods=['POST'])
def annotator():
    return render_template("annotator.html")

我希望能够在单击下拉菜单框之一并在帖子中发送name变量时转到url_for(“ annotator”)。也许有比使用标签更简单的方法。谢谢!

在此处输入图片说明

马特·L。

尝试这个:

<div class="dropdown">
    <button class="dropbtn"><h2>Please select your device <i class="fa fa-caret-down"></i></h2> </button>

    <div class="dropdown-content">

        <form action={{url_for("annotator")}} method='POST' id='annotator'>
        <select id='annotate_select' form='annotator'>
        {% for n in range(devicesFiles|length) %}
        <option value={{devicesFiles[n]}}>{{devicesFiles[n]}}</option>
        {% endfor %}
        </select>
        </form>

    </div>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在 Flask 中使用 POST 表单和 <a> 链接到另一个页面

如何使div链接到另一个页面?

使用javascript链接到另一个页面

如何使用一个按钮链接到另一个HTML页面?

使用Flask链接到网站内的另一个页面

在提示框中插入数据后如何链接到另一个页面

Thymeleaf:如何将按钮链接到另一个HTML页面?

Fullpage.js 如何链接到另一个带有 <a> 元素的 html 页面

如何将图像链接到另一个页面?

显示数据库中的图像并将其链接到另一个页面

将按钮链接到SweetAlert中的另一个页面

链接到php分页中的另一个页面?

Form_tag链接到另一个文件夹中的页面

链接到位于另一个页面中的锚点/ID

将在数据库中搜索的结果链接到另一个页面

使用jQuery元素链接到另一个页面

使用php链接到另一个html页面时访问被拒绝

链接到另一个HTML文件中的另一个div

如何使用按钮链接另一个页面?

我需要使用JavaScript或HTML链接到当前HTML页面内的另一个HTML页面

如何使按钮链接到同一页面中的另一个功能?

使用锚标记链接到Django中另一个应用程序(页面)中的特定div

如何链接到我的 MUI 迷你抽屉侧边栏中的另一个页面?

如何使用Express.js在内部链接到另一个HTML模板引擎页面?

Bootstrap 3:如何从Rails 4的另一个页面直接链接到选项卡

尝试从文件夹结构中更深的另一个html页面链接到index.html

如何将我的第一个输入框链接到数据库中已存在的另一个输入框

如何将数据从一个结构链接到另一个

如何检查一个节点是否链接到另一个节点?