Skip to content

Instantly share code, notes, and snippets.

@pmichali
Created June 10, 2013 21:46
Show Gist options
  • Save pmichali/5752671 to your computer and use it in GitHub Desktop.
Save pmichali/5752671 to your computer and use it in GitHub Desktop.
Conditional fields based on another
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Create Network" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create Network Profile") %}
{% endblock page_header %}
{% block main %}
{% include "admin/nexus1000v/_create_network_profile.html" %}
{% endblock %}
{% block js %}
{{ block.super }}
<script type="text/javascript">
$(document).ready(function() {
$("#id_segment_type").change(function() {
if ($(this).val() == "VLAN" || $(this).val() == "vlan") {
$("#id_multicast_ip_range").prop('disabled', true);
$("#id_physical_network").prop('disabled', false);
}
else {
$("#id_physical_network").prop('disabled', true);
$("#id_multicast_ip_range").prop('disabled', false);
}
});
});
</script>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment