问题
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
.
e.g:
navigate(uri="{xxf:instance('fr-parameters-instance')//linkTextbox}")
success-message(message = "{xxf:instance('fr-parameters-instance')//successMessageTextBox}")
Any suggestion would be appreciated!!
UPDATE :-
1>MetaData
if (exists(xxf:instance('fr-form-metadata')/linkTextbox))
then navigate(uri="{xxf:instance('fr-form-metadata')/linkTextbox}")
else nop
2>Formfeild
if (exists(xxf:instance('fr-form-instance')//linkTextbox))
then success-message(message = "{xxf:instance('fr-form-instance')//linkTextbox}")
else then success-message("save-success")
Code snap exists
<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>
Code snap is-blank
<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>
Error log :-
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
回答1:
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}")
来源:https://stackoverflow.com/questions/39318179/orbeon-custom-metadata-at-form-level