0
這裏被包裹輸入字段是我的註冊表單當W3C Django的驗證在<tr><th>
<form id="user_form" method="post" action="/accounts/register/">
{% csrf_token %}
{{ user_form }}
<br>
<input type="submit" class="btn btn-default pull-right" value="Register">
<br>
</form>
模板代碼當我檢查我的直播網站的HTML或我的本地環境中我看到下面的HTML
<form id="user_form" method="post" action="/accounts/register/">
<input type="hidden" name="csrfmiddlewaretoken" value="blah">
<label for="id_username">Username:</label><input class="form-control" id="id_username" name="username" type="text">
<label for="id_email">Email:</label><input class="form-control" id="id_email" name="email" type="email">
<label for="id_password">Password:</label><input class="form-control" id="id_password" name="password" type="password">
<br>
<input type="submit" class="btn btn-default pull-right" value="Register">
<br>
</form>
但是,當我確認在W3C我收到錯誤,因爲我的形式
Stray start tag tr. <tr><th><label for="id_username">Username:</label></th><td><inp…
而且我看到的標記已經改變
<form id="user_form" method="post" action="/accounts/register/">
<input type='hidden' name='csrfmiddlewaretoken' value='blah' />
<tr><th><label for="id_username">Username:</label></th><td><input class="form-control" id="id_username" name="username" type="text" /></td></tr>
<tr><th><label for="id_email">Email:</label></th><td><input class="form-control" id="id_email" name="email" type="email" /></td></tr>
<tr><th><label for="id_password">Password:</label></th><td><input class="form-control" id="id_password" name="password" type="password" /></td></tr>
<br>
<input type="submit" class="btn btn-default pull-right" value="Register">
<br>
</form>
as_p很感謝!仍然困惑,爲什麼W3C的抓取工具看到了額外的標記,但我沒有,我在多個瀏覽器中測試。 – beansontoast 2014-10-04 15:33:49