$('broadcast').value=derived[1];
}
+function macChecker(id, optional) {
+ var error= macCheckerSilent($(id).value);
+ if (error) {
+ Form.Element.focus($(id));
+ alert(error);
+ }
+}
+
+function macCheckerSilent(macAdd) {
+ var RegExPattern = /^[0-9a-fA-F:]+$/;
+
+ if (!(macAdd.match(RegExPattern)) || macAdd.length != 17)
+ {
+ return "Invalid MAC Address";
+ } else {
+ return "";
+ }
+}
+
/* check one */
function subnetChecker (id, optional) {
var error= subnetCheckerSilent([id,optional]);
$details->space();
$details->th_td("BW limit (bps)",$interface['bwlimit'],"bwlimit",array('width'=>11));
$details->th_td("Hostname",$interface['hostname'],"hostname");
+$details->th_td("Mac address",$interface['mac'],"mac", array('onChange'=>'macChecker("mac", true)'));
+
# xxx should the user be allowed to change this ?
-$mac=$interface['mac'];
-if ($mac) $details->th_td("MAC address",$mac);
+//$mac=$interface['mac'];
+//if ($mac) $details->th_td("MAC address",$mac);
// the buttons
$update_button = $form->submit_html ("update-interface","Update",