make 'mac' field on an interface editable.
[plewww.git] / planetlab / nodes / interface.js
index e97487f..434333e 100644 (file)
@@ -104,6 +104,25 @@ function networkHelper () {
   $('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]);