Replies: 1 comment 2 replies
-
You could use this one as a starting point: https://github.com/netbox-community/reports/blob/master/scripts/create_vm.py
There are the 'label' and 'description' attributes on the form field: 'label' appears to the left of the form field, and 'description' appears below it. What is it you want instead?
I'm not sure what you're saying here. Are you saying that the user first selects a Cluster (through an ObjectVar field), and based on which cluster they selected, this changes what options are available for a subsequent field? If so, that sounds similar to your second question. However in either case, I'm not aware of a way to do this. The custom script presents a static form to the user. Having the form change based on what other options are selected would require some sort of dynamic Javascript updates and/or AJAX to query objects at the back-end. You can of course do validation within your script, call log_failure if the user choses an invalid selection, and they can hit Back to correct it. It's not ideal though, and it would be nice if there were a way to perform validation which returns the user directly to the form.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am writing a custom script to provision virtual machine.
I'm bad in frontend development... May I know how to add a text that appear next to the form field? I wish to know what is the current "cluster total VM" disk space (custom field) when user is selecting the disk size. Is it developing a plugin?
How to dynamic filter a list based on the object custom field?
For example:
disk = ChoiceVar(
[10,20,50,100],
label="Disk (GB)",
required=True,
description="CPU")
I want to filter out 10 and 20, if the user select device == "server1".
Beta Was this translation helpful? Give feedback.
All reactions