表单级别的Orbeon自定义元数据

表单级别的Orbeon自定义元数据

本文介绍了表单级别的Orbeon自定义元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过formBuilder在表单级别(元数据)配置成功消息(successMessageTextBox)和 downloadLink (linkTextbox),以便管理员可以随时更改和发布.这些值也可以通过properties-local.xml文件访问以配置success-message.

I want to configure success message(successMessageTextBox) and downloadLink(linkTextbox) at form level(meta-data) through formBuilder, so that admin can change and publish it anytime. Also these values can be accessible to properties-local.xml file to configure the success-message.

例如:

navigate(uri="{xxf:instance('fr-parameters-instance')//linkTextbox}")

success-message(message = "{xxf:instance('fr-parameters-instance')//successMessageTextBox}")

任何建议将不胜感激!

UPDATE :-

UPDATE :-

1> MetaData

1>MetaData

  if (exists(xxf:instance('fr-form-metadata')/linkTextbox)‌​)
            then navigate(uri="{xxf:instance('fr-form-metadata')/linkTextbox}")
            else nop

2>伪造

if (exists(xxf:instance('fr-form-instance')//linkTextbox)‌​)
        then success-message(message = "{xxf:instance('fr-form-instance')//linkTextbox}")
        else then success-message("save-success")

存在代码捕捉

 <property as="xs:string"  name="oxf.fr.detail.process.save-final.*.*">
            require-uploads
            then validate-all
            then save
            if (exists(xxf:instance('fr-form-instance')//linkTextbox)‌​)
            then navigate(uri="{xxf:instance('fr-form-instance')//linkTextbox}")
            else nop
            recover error-message("database-error")
  </property>

代码捕捉为空白

    <property as="xs:string"  name="oxf.fr.detail.process.save-final.*.*">
                    require-uploads
                    then validate-all
                    then save
                   then
                   (
                     if ("not(xxf:is-blank(xxf:instance('fr-form-instance')//msg))")
                     then success-message(message = "{xxf:instance('fr-form-instance')//msg}")
                     else nop
                    )
                    recover error-message("database-error")
          </property>

错误日志:-

2016-09-26 23:06:44,925 INFO  lifecycle  - event: {"request": "21", "session": "AA57957F553E16581E264D06E3241BFD", "source": "fr", "message": "start: process", "uuid": "3bd78eb64e035d7d710a74049c972aca086b095a", "scope": "oxf.fr.detail.process", "name": "save-final-custom"}
2016-09-26 23:06:45,302 ERROR XFormsServer  -
+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Invalid source:                                                                                                       |
|Invalid input 'f', expected OptWhiteSpace or ')' (line 9, pos 39):                                                    |
|  if ('not(xxf:is-blank(xxf:instanc                                                                                   |
|e('fr-form-instance')//msg))')                                                                                        |
|                                      ^                                                                               |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.parboiled.errors.ParsingException                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.fr.process.ProcessParser$           |parse                         |ProcessParser.scala           | 121|
|nterpreter$ProcessRuntime$$anonfun$parseProcess$1$1|apply                         |ProcessInterpreter.scala      | 201|
|nterpreter$ProcessRuntime$$anonfun$parseProcess$1$1|apply                         |ProcessInterpreter.scala      | 201|
|org.orbeon.oxf.util.ScalaUtils$BooleanWrapper$     |option$extension              |ScalaUtils.scala              | 115|
|n.oxf.fr.process.ProcessInterpreter$ProcessRuntime$|parseProcess$1                |ProcessInterpreter.scala      | 201|
|n.oxf.fr.process.ProcessInterpreter$ProcessRuntime$|runSubProcess                 |ProcessInterpreter.scala      | 203|
|nonfun$apply$11$$anonfun$apply$12$$anonfun$apply$13|apply                         |ProcessInterpreter.scala      | 235|
|nonfun$apply$11$$anonfun$apply$12$$anonfun$apply$13|apply                         |ProcessInterpreter.scala      | 235|
|scala.util.control.Breaks$$anon$1                  |catchBreak                    |Breaks.scala                  |  63|
|un$runProcess$3$$anonfun$apply$11$$anonfun$apply$12|apply                         |ProcessInterpreter.scala      | 236|
|un$runProcess$3$$anonfun$apply$11$$anonfun$apply$12|apply                         |ProcessInterpreter.scala      | 233|
|scala.util.Success                                 |flatMap                       |Try.scala                     | 231|
|Interpreter$$anonfun$runProcess$3$$anonfun$apply$11|apply                         |ProcessInterpreter.scala      | 233|
|Interpreter$$anonfun$runProcess$3$$anonfun$apply$11|apply                         |ProcessInterpreter.scala      | 241|
|org.orbeon.oxf.util.DynamicVariable                |withValue                     |DynamicVariable.scala         |  42|
|n.oxf.fr.process.ProcessInterpreter$ProcessRuntime$|withEmptyStack                |ProcessInterpreter.scala      |  96|
|fr.process.ProcessInterpreter$$anonfun$runProcess$3|apply                         |ProcessInterpreter.scala      | 232|
|fr.process.ProcessInterpreter$$anonfun$runProcess$3|apply                         |ProcessInterpreter.scala      | 232|
+----------------------------------------------------------------------------------------------------------------------+
2016-09-26 23:06:45,396 INFO  lifecycle  - event: {"request": "21", "session": "AA57957F553E16581E264D06E3241BFD", "source": "fr", "message": "end: process", "time": "471 ms"}
2016-09-26 23:06:45,593 INFO  lifecycle  - event: {"request": "21", "session": "AA57957F553E16581E264D06E3241BFD", "source": "xforms", "message": "after cacheOrStore", "document cache current size": "1", "document cache max size": "50"}
2016-09-26 23:06:45,594 INFO  ProcessorService  - /xforms-server - Timing: 1198

推荐答案

我宁愿将此添加到fr-form-metadata实例中,例如通过在表单生成器"中编辑表单的来源,并在<metadata>内添加<success-message>:

I would rather add this to the fr-form-metadata instance, e.g. by editing the source of the form in Form Builder, and adding, say, a <success-message> inside <metadata>:

<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
    <metadata>
        ...
        <success-message>Submitted, all good!</success-message>
    </metadata>
</xf:instance>

然后,在您的流程中,您可以通过以下方式显示该消息:

Then, in your process, you can show that message with:

success-message(message = "{xxf:instance('fr-form-metadata')/success-message}")

这篇关于表单级别的Orbeon自定义元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 12:14