DEV Community

Guy Shilo
Guy Shilo

Posted on

Dynamic default value in a form fiels, is it possible ?

Hello

In a Colab form, is there away to give a field a dynamic default value ?
For example, I have a field called "project_id" and I want to automatically detect the current project_id and set it as a default value for this field.

I detect the project id and put it into variable "projid":

import google.auth
projid = google.auth.default()[1]

Then I try to use it like this:
project_id = projid # @param {"type":"string"}

But it puts the string "projid" in that firld instead of the value of the projid variable.

Is there a way to make it work ?

Thanks

Guy

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay