Replies: 2 comments
-
Have you tried using an evenrule that triggers on create/update of the object the custom field is attached to? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have seen an example of a custom validator being used to fill in the default value for an empty field, so I don't see why it couldn't be used to modify the value of an existing field. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Let use the 'mac address' field as an example. If I input a MAC address for an interface in netbox, I can input the mac in a number of different ways.
IIRC those are all the accepted input methods for a MAC address. But once you click save, NetBox automatically converts any of those inputs to a consistent value. It will always convert the MAC to the following format: XX:XX:XX:XX:XX:XX
Is there a way to accomplish this same thing with custom fields and field validation? If I want to have a custom field that is supposed to be phone numbers. I can do a regex for north american 10 digit numbers that would look like this:
^\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$
Which according to the regex documentation I have, would accept the following:
But regardless of how the 10 digit number was inputted (with or without dashes, with or without parenthesis for the area code), how would I insure that once the value is saved, that NetBox would always display the value consistently?
IE: (xxx) xxx-xxxx
Beta Was this translation helpful? Give feedback.
All reactions