Custom option in form

am I reading this correctly?

I have

c.Spawner.options_from_form = “simple”
c.Spawner.apply_user_options = {“dataset”: “dataset”}

and a form that returns

    <select class="form-control" name="dataset" required autofocus>

should I get a variable user_options

apply_user_options is used to set configurable Traitlets properties on the spawner. For example, in your case you’re trying to set Spawner.dataset but spawners don’t have that property.

If you give us more information on what you’re trying to do we might be able to help.

1 Like

well I have got a lot farther.. now just accessing the options[‘dataset’] to link the correct directory.

from dockerspawner import DockerSpawner as Spawner

class MyCustomSpawner(Spawner):
def options_from_form(self, formdata):
options = {}
options[‘image’] = formdata.get(‘image’, [‘’])[0]
options[‘dataset’] = formdata.get(‘dataset’, [‘’])[0]
return options

async def start(self):
    image = self.user_options.get('image')
    dataset = self.user_options.get('dataset')

    return await super().start() # Call parent's start method

async def stop(self):
    return await super().stop()

async def poll(self):
    return await super().poll()

c.JupyterHub.spawner_class = MyCustomSpawner