question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set default value for "stoarge" in File Component [Question]

See original GitHub issue

Hi There,

I want to set the default value of “Storage” to “URL” and remove all other fields like s3, dropbox…

I want to do this on Formio.builder() and as well as on Formio.createForm()

Thanks, Rohit

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rohitcodercommented, Apr 27, 2020

@yuzdeng

You could acheive this by setting a default option to this kind of fields using

"components":   {
      "file":{
         "schema":{
            "type":"file",
            "storage":"url",
            "url":"https://google.com"
         }
      }
   }

and then you can hide this using

editForm: {
    textfield: [
      {
        key: 'api',
        ignore: true
      },{
        key: 'data',
        ignore: true
      }        
    ]
  }

Note : You should also check provided default values at the server side to verify data, otherwise someone can play with these hidden data.

Just keep chaining this method in different components, at the end, you’ll be able to achieve whatever you want.

Obviously, you can also change the system config from the core library, but that won’t be easy task compared to this method.

1reaction
rohitcodercommented, Apr 10, 2020

If i create a new custom component using this then i can set a default value for this stuff, but is it possible to override main component?

   "components":   {
      "file":{
         "schema":{
            "type":"file",
            "storage":"url",
            "url":"https://google.com"
         }
      }
   }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify default value for HTML5 Local Storage item?
Is there not a way to specify default values for each local storage item in the case that it doesn't exist? Most programming...
Read more >
MySQL specify default value when data has incorrect values
My table has default values in the columns but the defaults are not being used in cases where the data file has incorrect...
Read more >
How to set default value in select using ReactJS
You can use an attribute defaultValue to set the default value in the Select menu If none option is integrated with this attribute...
Read more >
Named arguments don't work with default values? - Ember.JS
So it seems like setting an attribute in the component's code when it's not passed in doesn't make it available as a named...
Read more >
Value in Copy Activity to Synapse DW not populating in sink
In our Copy activity in our load pipeline, for the sink, we populate the Default values Value field for the column with @utcnow()....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found