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.

Unable to pass a boolean input to readOnly (@rjsf/bootstrap-4)

See original GitHub issue

Prerequisites

Description

Cannot pass a boolean input to readOnly with de Bootstrap4 theme but it is possible with MaterialUI theme.

Steps to Reproduce

Imports

import React from "react";
import { Theme as Bootstrap4Theme } from "@rjsf/bootstrap-4";
import {
  withTheme
} from "@rjsf/core";

Code

  const JsonSchemaForm = withTheme(Bootstrap4Theme);
  return (
    <div style={{ position: "relative" }}>
      <JsonSchemaForm
	schema={{
 	 "title": "Entité",
	  "type": "object",
	  "properties": {
	    "@id": {
	      "type": "string",
 	     "title":"ID"
  	  },
  	  "nom": {
   	   "type": "string",
 	     "title":"Nom"
  	  },
  	  "prenom": {
  	    "type": "string"
  	  },
  	  "email": {
  	    "type": "string"
  	  },
   	 "age": {
   	   "type": "number"
  	  },
  	  "sdf": {
 	     "type": "boolean"
 	   }
	  },
	  "required": ["@id", "nom", "prenom", "email", "age", "sdf"]
	}}
        uiSchema={ {
          nom: {"ui:readonly": true},
          sdf: {"ui:readonly": true}
        }
        }
      />
      </JsonSchemaForm>
  );

Expected behavior

Have the input read only as the MaterialUI theme Screenshot (materialUI theme): image

Actual behavior

Simple boolean input Screenshot (bootstrap theme) image

Version

@rjsf/bootstrap-4”: “^2.4.2” “@rjsf/core”: “^2.3.0” “@rjsf/material-ui”: “^2.3.0”

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
HarmonicTonscommented, Mar 25, 2021

@paintedbicycle I tried again (still on gitpod) and this time it worked. I didn’t change a thing: Fresh clone, fresh dev env, node v14.16.0, npm v6.14.11.

@epicfaace in my newly working workspace the version of @types/json-schema are different in material-ui and core:

0reactions
paintedbicyclecommented, Mar 27, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

unable to pass boolean value - html - Stack Overflow
I have a form field/checkbox and am unable to pass the boolean value even though it is selected. <input type="checkbox" name ...
Read more >
Unable to pass boolean value False through --extra-vars ...
Running playbook with passing foobar=True as extra-vars parameter works as expected.
Read more >
boolean variable to boolean parameter
Hi,. I'm unable to pass a boolean variable to a boolean parameter, I always have this error message "is not a valid boolean",...
Read more >
How To Use HTML5 Input Types | DigitalOcean
Let's go over all the possible HTML input types; from the default text input, ... readonly - boolean whether the input should be...
Read more >
What is wrong with boolean parameters?
Working with Legacy Code, it's not uncommon to come across boolean parameters. ... 2 booleans would create an eventual 4th “impossible” state that...
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