Checking all elements with one click with Tornado

守給你的承諾、 提交于 2020-01-25 07:13:11

问题


I have this part of code in my html page:

{% if users %}
        {% for user in users %}

        <form name="form_user_{{ user.id }}" method="post" action="/networks/{{ net.id }}/sensors/{{ sens.id }}/rights">
          <tr>
            <td>
              <div>
                {{ escape(user.name) }}
                <input type='hidden' name="id" value='{{ user.id }}'>
              </div>
            </td>
            <td>

              <label class="radio inline" onclick="document.forms['form_user_{{ user.id }}'].submit();">
                <input type="radio" name="perms" id="perms_{{user.id}}_0" value="0">
                None
              </label>
              <label class="radio inline" onclick="document.forms['form_user_{{ user.id }}'].submit();">
                <input type="radio" name="perms" id="perms_{{user.id}}_1" value="1">
                Read
              </label>
              <label class="radio inline" onclick="document.forms['form_user_{{ user.id }}'].submit();">
                <input type="radio" name="perms" id="perms_{{user.id}}_4" value="4">
                Read + Commands
              </label>

              {{ xsrf_form_html() }}
            </td>

          </tr>
        </form>
        {% end %}
        {% end %}

where I have a list of users from Tornado and I can set them a permission on a sensor. I would create on the top of this list a check element for every permission to assign too fast the same permission to the users.

For example if we click on a check element for the permission with value 4, I would that for every user in the users list the permission is set to 4. Something like click on every check one at time.

I'm sorry for my english. How can I do this?

来源:https://stackoverflow.com/questions/15388426/checking-all-elements-with-one-click-with-tornado

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!