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 projec…


This content originally appeared on DEV Community and was authored by Guy Shilo

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


This content originally appeared on DEV Community and was authored by Guy Shilo


Print Share Comment Cite Upload Translate Updates
APA

Guy Shilo | Sciencx (2024-09-19T19:23:46+00:00) Dynamic default value in a form fiels, is it possible ?. Retrieved from https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/

MLA
" » Dynamic default value in a form fiels, is it possible ?." Guy Shilo | Sciencx - Thursday September 19, 2024, https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/
HARVARD
Guy Shilo | Sciencx Thursday September 19, 2024 » Dynamic default value in a form fiels, is it possible ?., viewed ,<https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/>
VANCOUVER
Guy Shilo | Sciencx - » Dynamic default value in a form fiels, is it possible ?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/
CHICAGO
" » Dynamic default value in a form fiels, is it possible ?." Guy Shilo | Sciencx - Accessed . https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/
IEEE
" » Dynamic default value in a form fiels, is it possible ?." Guy Shilo | Sciencx [Online]. Available: https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/. [Accessed: ]
rf:citation
» Dynamic default value in a form fiels, is it possible ? | Guy Shilo | Sciencx | https://www.scien.cx/2024/09/19/dynamic-default-value-in-a-form-fiels-is-it-possible/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.