Project

General

Profile

« Previous | Next » 

Revision ec996cd7

Added by sbeaver about 10 years ago

Use toggles as suggested

Thanks,

The toggle system was a WIP when I did this page I think. It works
nicely now in this instance.

View differences:

usr/local/www/pkg_mgr_settings.php
94 94
	'Enable Alternate',
95 95
	'Use a non-official server for packages',
96 96
	$curcfg['enable']
97
));
97
))->toggles('.form-group:not(:first-child)');
98 98

  
99 99
$section->addInput(new Form_Input(
100 100
	'pkgrepourl',
......
106 106

  
107 107
$form->add($section);
108 108
print($form);
109
?>
110
<script>
111
//<![CDATA[
112
events.push(function() {
113
	// Disables the specified input element
114
	function disableInput(id, disable) {
115
		$('#' + id).prop("disabled", disable);
116
	}
117

  
118
	function set_url_hide() {
119
		if($('#alturlenable').is(':checked'))
120
			disableInput('pkgrepourl', false);
121
		else
122
			disableInput('pkgrepourl', true);
123
	}
124

  
125
	// Set initial state
126
	set_url_hide();
127

  
128
	// When the checkbox is checked
129
	$('#alturlenable').on('change', function() {
130
		set_url_hide()
131
	});
132
});
133
//]]>
134
</script>
135 109

  
136
<?php include("foot.inc");
110
include("foot.inc");

Also available in: Unified diff