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

Guy Shilo - Sep 19 - - Dev Community

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

.
Terabox Video Player