applications/luci-firewall: javascript & validation fixes in quickaction forms

This commit is contained in:
Jo-Philipp Wich 2012-08-09 10:16:03 +00:00
parent a2e93572a9
commit 6c66d91336
2 changed files with 3 additions and 2 deletions

View file

@ -73,7 +73,7 @@
</table>
<script type="text/javascript">//<![CDATA[
cbi_validate_field('_newopen.extport', true, 'list(portrange)');
cbi_validate_field('_newopen.extport', true, 'list(neg(portrange))');
cbi_bind(document.getElementById('_newopen.extport'), 'blur',
function() {
var n = document.getElementById('_newopen.name');

View file

@ -52,10 +52,11 @@
<script type="text/javascript">//<![CDATA[
cbi_validate_field('_newsnat.dport', true, 'portrange');
cbi_validate_field('_newsnat.dip', true, 'ip4addr');
cbi_combobox_init('_newsnat.dip', {
<% local c, k, v = 0; for k, v in ipairs(nw:get_interfaces()) do -%>
<%- local a; for k, a in ipairs(v:ipaddrs()) do c = c + 1 -%>
<% if c > 1 then %>,<% end %>'<%=a:host():string()%>': '<%=a:host():string()%> (<%=v:shortname()%>)',
<% if c > 1 then %>,<% end %>'<%=a:host():string()%>': '<%=a:host():string()%> (<%=v:shortname()%>)'
<%- end %>
<%- end %> }, '<%: -- Please choose -- %>', '<%: -- custom -- %>');
//]]></script>