ULB-Darmstadt / shacl-form

HTML5 web component for editing/viewing RDF data that conform to SHACL shapes
https://ulb-darmstadt.github.io/shacl-form/
MIT License
28 stars 5 forks source link

QUESTION: Rendered form control as "output" #14

Closed claudius108 closed 4 months ago

claudius108 commented 4 months ago

Hi!

Before everything, I have to say that this component is absolutely magnificent!

I looked at the datatypes, and I have not seen a rendered "output" form control, which I need for a default value that has not to be modified by the user.

Would you recommend me a plugin for this, or there is something else I missed so far?

Thank you! Claudius

s-tittel commented 4 months ago

Hi and thanks!

You can use sh:hasValue for that. Since v1.4.4, <shacl-form> renders a disabled (non-editable) input field in this case. For example:

      @prefix sh: <http://www.w3.org/ns/shacl#> .
      @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
      @prefix ex: <http://example.org#> .

      ex:ExampleShape
        a sh:NodeShape, rdfs:Class ;
        sh:property [
          sh:name 'my value' ;
          sh:hasValue 'non editable default value' ;
          sh:path ex:exampleValue ;
        ] .
claudius108 commented 4 months ago

Thanks!