edit_category.tpl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {% extends app.template_style ~ "/layout/layout_1_col.tpl" %}
  2. {% block content %}
  3. <script>
  4. function check() {
  5. $("#parent_id option:selected").each(function() {
  6. var id = $(this).val();
  7. var name = $(this).text();
  8. if (id != "" ) {
  9. $.ajax({
  10. async: false,
  11. url: "{{ _p.web_ajax }}exercise.ajax.php?type=global&a=exercise_category_exists",
  12. data: "id="+id,
  13. success: function(return_value) {
  14. if (return_value == 0 ) {
  15. alert("{{ 'CategoryDoesNotExists' | get_lang }}");
  16. //Deleting select option tag
  17. $("#parent_id").find("option").remove();
  18. $(".holder li").each(function () {
  19. if ($(this).attr("rel") == id) {
  20. $(this).remove();
  21. }
  22. });
  23. }
  24. }
  25. });
  26. }
  27. });
  28. }
  29. $(function() {
  30. $("#parent_id").fcbkcomplete({
  31. json_url: "{{ _p.web_ajax }}exercise.ajax.php?type=global&a=search_category_parent",
  32. maxitems: 1,
  33. addontab: false,
  34. input_min_size: 1,
  35. cache: false,
  36. complete_text:"{{ 'StartToType' | get_lang }}",
  37. firstselected: false,
  38. onselect: check,
  39. filter_selected: true,
  40. newel: true
  41. });
  42. });
  43. </script>
  44. {{ form }}
  45. {% endblock %}