Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. {% extends "base.html" %}
  2.  
  3. {% block title %}Оплата курсу{% endblock %}
  4.  
  5. {% block content %}
  6. <h2>Оплата курсу</h2>
  7. <h2>Назва курсу: {{ course.title }}</h2>
  8. <p>Course id: {{ course.id }}(test)</p>
  9.  
  10.  
  11. <div>
  12. <input type="radio" id="typeUserChoice1" name="type_user" value="student">
  13. <label for="contactChoice1">Купую своїй дитині</label>
  14.  
  15. <input type="radio" id="typeUserChoice2" name="type_user" value="parent">
  16. <label for="contactChoice2">Купую собі</label>
  17. </div>
  18.  
  19.  
  20.  
  21. <div class="form1">
  22. <form action="." method="post">
  23. {{ parent_form.as_p }}
  24. {% csrf_token %}
  25. <p><input type="submit" value="Зареєструватись1"></p>
  26. </form>
  27. </div>
  28.  
  29. <div class="form2">
  30. <form action="." method="post">
  31. {{ student_form.as_p }}
  32. {% csrf_token %}
  33. <p><input type="submit" value="Зареєструватись1"></p>
  34. </form>
  35. </div>
  36.  
  37.  
  38. <script>
  39. let el1 = document.getElementById('typeUserChoice1');
  40. let el2 = document.getElementById('typeUserChoice2');
  41.  
  42. let first_radio = document.querySelector('.form1');
  43. let two_radio = document.querySelector('.form2');
  44.  
  45. el1.addEventListener('click', formFunction);
  46. el2.addEventListener('click', formFunction);
  47.  
  48. function formFunction(){
  49. let el1 = document.getElementById('typeUserChoice1');
  50. let el2 = document.getElementById('typeUserChoice2');
  51. if(el1.checked) {
  52. first_radio.classList.add('visible');
  53. two_radio.classList.remove('visible');
  54.  
  55. }else if(el2.checked){
  56. two_radio.classList.add('visible');
  57. first_radio.classList.remove('visible');
  58. }else {
  59. console.log('a')
  60. }
  61. }
  62. </script>
  63.  
  64.  
  65. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement