123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <!DOCTYPE html>
- {% load static %}
- <html>
- <head>
- {#<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">#}
- <script type="text/javascript">
- window.onerror = function (msg) {
- document.getElementById('body').setAttribute('JSError', msg)
- }
- </script>
- {{ form.media.css }}
- </head>
- <body id="body">
- <form method="post">
- {% csrf_token %}
- {{ form }}
- <input type="submit" name="save" value="Save"/>
- <button type="submit" name="save_continue" value="continue_value">Save & continue</button>
- <div class="progress">
- <div class="progress-bar" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0"
- aria-valuemax="100">0%
- </div>
- </div>
- </form>
- {{ form.media.js }}
- <script>
- (function () {
- var form = document.getElementsByTagName('form')[0]
- var progressBar = document.getElementsByClassName('progress-bar')[0]
- var input = document.createElement('input')
- input.type = 'hidden'
- input.name = 'progress'
- form.appendChild(input)
- form.addEventListener('progress', function (event) {
- // event.detail.progress is a value between 0 and 1
- var percent = Math.round(event.detail.progress * 100)
- progressBar.setAttribute('style', 'width:' + percent + '%')
- progressBar.setAttribute('aria-valuenow', percent)
- progressBar.innerText = percent + '%'
- input.value = event.detail.progress
- })
- })()
- </script>
- </body>
|