javascript - Append parameter 'form id' with the URL -


i have code of html (django + jinja) .

<div class="span10 well">     {% k in values.chat %}         <label> text : {{k.text}} </label>         <label> {{k.date_time}} </label>    {% endfor %}           <form action = "#" method = "post" id = {{key}} name = "reply_form">        {% csrf_token %}        {{ form.as_p }}          <input type = "submit" value = "sent" class="btn btn-primary">    </form>  </div> 

since, there many chats , correspondingly reply submit button , key, want when reply specific chat, carries key , process chat accordingly.

what need append url form id parameter. how can achieve this?

you can create hidden input field

<input type="hidden" name="chat_key" value="{{key}}"> 

this way can track chatroom person responding setting value id of chatroom.

edit: since using django, on backend value of chat_key can this:

chat_key = form.cleaned_data['chat_key'] 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -