Search code examples
orbeon

Orbeon form: Disable form fields after clicking "Submit"


I'm trying to configure "Send" process to set all fields to readonly, but it didn't work. Here is my configuration in properties.xml:

        <property as="xs:string" name="oxf.fr.detail.process.send.*.*">
            require-valid
            then save
            then success-message("save-success")
            then xf:setvalue(ref = "//*[xf:readonly]", value = "true()")
        </property>

Thanks for all suggestions!


Solution

  • You cannot set the "readonly-ness", in an imperative imperative way, with a xf:setvalue. Instead, the "readonly-ness" is define in a declarative way. In your case, I would recommend that:

    1. When the form is submitted, you change the stage of the form, say to "submitted". In your process, you can do so with (doc):

       set-workflow-stage(name = "submitted")
      
    2. In Form Builder, you use a form level formula (doc) to declare that the whole form is readonly if the stage is "submitted". The formula will look like:

       fr:workflow-stage-value() = 'submitted'
      

    Also see the blog post New workflow capabilities in Orbeon Forms 2020.1.