【问题标题】:HTML not printing the full name returned by flaskHTML 不打印烧瓶返回的全名
【发布时间】:2020-06-28 07:23:35
【问题描述】:

我想知道为什么输入字段只显示 Varun 而不是 Varun Achar

以下是我的 HTML 页面的代码。

{%if users%}
  <label >
    Patient ID
  </label>
  <input type="text" name="PID" value={{  users[1]  }}>
  <label >
    Patient Name:
  </label>
  <input type="text" name="pname" value={{  users[2]  }} />   
{%endif%}

这里在命令提示符中打印 Varun Achar,但在前面的 HTML 输入字段中,它只打印 Varun

请帮助解决这个问题

【问题讨论】:

  • 请正确格式化你的代码并显示你的python代码。

标签: html flask web-development-server


【解决方案1】:

您只需将 value 用双引号括起来。

{%if users%}
  <label>
    Patient ID
  </label>
  <input type="text" name="PID" value= "{{users[1]}}">
  <label>
    Patient Name:
  </label>
  <input type="text" name="pname" value="{{users[2]}}"/>
{%endif%}

【讨论】:

    猜你喜欢
    • 2017-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-20
    • 2019-03-23
    • 1970-01-01
    • 2020-12-25
    • 2021-03-30
    相关资源
    最近更新 更多