0
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script src="/static/js/textext.js" type="text/javascript"></script>

<form name="submission" onsubmit="" action="/my_content/{{set.id}}/add/" method="POST">
{% csrf_token %}
<textarea rows="5" class = "input-block-level" width=100% input type="text"     name="front" id="front" placeholder="Question..." required></textarea>
<textarea class = "input-block-level" rows="5" input type="text" name="back" id="back" placeholder="Answer..." required></textarea>
<textarea class = "input-block-level" id="category" name="category" placeholder =""     rows="1" ></textarea>
<button type="submit" class="btn btn-info">Submit</button>
</form>

<script>
    $('#category').textext({...etc...
</script>

我正在使用 jQuery 插件将 textarea 转换为启用标签的输入框,使用 TextExt 1.3.1。这是一个很棒的插件,我不想放弃它,但是当我启用插件时,我的 textarea 从表单 POST 数据中消失了。我已经对 id 进行了三次检查,并且由于插件工作正常,我无法弄清楚为什么 textarea 数据没有与表单一起提交。我目前正在使用 django 模板处理,因此您会注意到 CSRF 标记。

这是浏览器看到的源代码:

<table class="table"><thead>
<h3><a href="/my_content/">My Content</a> > <a href="/my_content/31/">asdf</a></h3>
<form name="submission" onsubmit="" action="/my_content/31/add/" method="POST">
   <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='3onHid0y5LCQDM71Zxd45GURxOl5cjgl' /></div>
   <input type="hidden" />
<div class="well">  
    <textarea rows="5" class = "input-block-level" width=100% input type="text" name="front" id="front" placeholder="Question..." required></textarea>
    <span class="help-block"></span></div>
            <div class="well">
            <textarea class = "input-block-level" rows="5" input type="text" name="back" id="back" placeholder="Answer..." required></textarea>
            <textarea class = "input=block-level" id="category" name="category" placeholder ="" rows="1" ></textarea>
        <span class="help-block"></span></div>
<button type="submit" class="btn btn-info">Submit</button>
</form>
Items: 26
4

0 回答 0