Commits

Zhang Huangbin committed 7e5d7d5

Fix js onchange issue without jquery.

  • Participants
  • Parent commits a173709

Comments (0)

Files changed (3)

templates/default/ldap/domain_profile.html

                     <input type="hidden" name="domainName" value="{{cur_domain}}" />
                     <li><span><strong>{{ _('Domain Name') }}</strong>
                         <span>
-                            <select id="domainSelect" name="domainName" onchange="listAccountsUnderDomain(this, baseurl='{{ctx.homepath}}/profile/domain/{{profile_type}}/');">
+                            <select id="domainSelect" name="domainName" onchange="changeDomain(this, baseurl='{{ctx.homepath}}/profile/domain/{{profile_type}}/');">
                                 {% for d in allDomains %}
                                 <option value="{{d[1].domainName[0]}}" {% if cur_domain == d[1].domainName[0] %}selected{%endif%}>{{d[1].domainName[0]}}</option>
                                 {% endfor %}

templates/default/ldap/layout.html

             {% endblock jquery_snippet_sorter %}
             {% block jquery_snippets %}{% endblock jquery_snippets %}
         });
+    </script>
+    {% endblock jquery_docoment_ready %}
 
-        function listAccountsUnderDomain(domain, baseurl) {
-            d = $('#domainSelect').val();
-            if ( d != 'none' ) {
-                location.href = baseurl + d;
-            }
+    <script type="text/javascript">
+        function changeDomain(domain, baseurl) {
+            location.href = baseurl + domain.options[domain.selectedIndex].value;
         }
     </script>
-    {% endblock jquery_docoment_ready %}
 
 </head>
 <body>

templates/default/ldap/users.html

 {% block id_welcome %}
 <span>{{ _('View users under domain:') }} </span>
 <span>
-    <select id="domainSelect" name="domainName" onchange="listAccountsUnderDomain(this, baseurl='{{ctx.homepath}}/users/');">
+    <select id="domainSelect" name="domainName" onchange="changeDomain(this, baseurl='{{ctx.homepath}}/users/');">
         <option value="none" {% if cur_domain is sameas none %}selected{%endif%}>{{ _('Select one domain') }}</option>
         {% for d in allDomains %}
             <option value="{{d[1].domainName[0]}}" {% if cur_domain == d[1].domainName[0] %}selected{%endif%}>{{d[1].domainName[0]}}</option>