            {% load freeadmin %}{% if form.isAdvanced %}
            <button id="btn_{% cls_name form %}_AdvMode" class="advModeButton" data-dojo-type="dijit.form.Button" data-dojo-props="mode: '{% if form.advDefault %}advanced{% else %}basic{% endif %}'">
                <script type="dojo/method">
                  var form = getForm(this);
                  form.advancedToggle = function(btn) {
                    dojo.forEach(dojo.query(".advancedField", form.domNode), function(node, idx) {
                        var tr = node;
                        if(btn.mode == 'basic') {
                            dojo.style(tr, "display", "table-row");
                        } else {
                            dojo.style(tr, "display", "none");
                        }
                    });
                    if(btn.mode == 'basic') {
                        btn.mode = 'advanced';
                        btn.set('label', '{% trans "Basic Mode"|escapejs %}');
                    } else {
                        btn.mode = 'basic';
                        btn.set('label', '{% trans "Advanced Mode"|escapejs %}');
                    }
                    var dialog = getDialog(this);
                    if(dialog) {
                        //dialog.layout();
                        dialog._size();
                        dialog._position();
                    }
                  }
                </script>
                <script type="dojo/event" data-dojo-event="onClick" data-dojo-args="e">
                  var form = getForm(this);
                  var btn = this;
                  form.advancedToggle(btn);
                </script>
                {% if form.advDefault %}
                {% trans "Basic Mode" %}
                {% else %}
                {% trans "Advanced Mode" %}
                {% endif %}
            </button>
            {% endif %}
