Преглед на файлове

Disable input onsubmit

Used to make the post send empty field.
Tweak: disable on setTimeout
master
The Dod преди 1 година
родител
ревизия
6c55b9ae45
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 5
    3
      templates/chat.html

+ 5
- 3
templates/chat.html Целия файл

@@ -30,15 +30,17 @@
30 30
                                         <div class="scrollable">
31 31
                                             {{ content|safe }}
32 32
                                         </div>
33
-                                        <form method="POST" action="">
34
-                                        <!-- onsubmit='document.getElementById("prompt").setAttribute("disabled", "")' -->
33
+                                        <form method="POST" action=""
34
+                                            onsubmit='setTimeout(() => { document.getElementById("prompt").setAttribute("disabled", ""); }, 100)'>
35 35
                                             <input class="prompt" id="prompt" name="prompt" placeholder="Talk to me" />
36 36
                                         </form>
37 37
                                     </section>
38 38
 				    {% for moment in history %}
39 39
 				    <section data-background-size="cover" data-background-video="{{moment.bg_video}}" data-background-opacity="0.75" data-background-video-loop="True" data-background-video-mute="True">
40 40
 					    <h3 class="title slide_title">{{moment.title}}</h3>
41
-					    <input class="prompt" value="{{moment.prompt}}" disabled />
41
+                                            {% if moment.prompt %}
42
+					        <input class="prompt" value="{{moment.prompt}}" disabled />
43
+                                            {% endif %}
42 44
                                             <div class="scrollable">
43 45
 						    {{ moment.content|safe }}
44 46
                                             </div>

Loading…
Отказ
Запис