I would like to know if it is possible to trigger either a Java servlet, Javascript or a local Bash script when I submit a form in orbeon?
Thanks
Calling Javascript:
You can call Javascript by adding the following inside your action:
<xxf:script>
//Add your script here
</xxf:script>
Calling a Java Servlet:
Create a submission: If you are using the Form Builder you can do it by creating a HTTP service, similar to the way a service is created in this link: http://wiki.orbeon.com/forms/how-to/fb-fr/call-service
If you are not using the Form Builder or prefer to write the submission manually:
<x:submission id="my-submission"
method=""
validate=""
relevant=""
resource="" replace="none" ../>
After creating a submission to call your Servlet, you have to send it from your action and it'll call the Servlet: <xf:send submission="my-submission"/>
http://wiki.orbeon.com/forms/doc/developer-guide/xforms-advanced-submissions
Action and Events
If you want to call it after submiting and saving the form and you are using Form Builder:
<xf:action ev:event="fr-data-save-done" ev:observer:"fr-form-model">
//Call the javascript or Servlet
</xf:action>
If you are not using Form Builder, just change ev:event/ev:observer according to your needs. xf:send also accepts these attributes.
Related
For passing XSRF token with Struts2 forms, I have to put the token tag inside all forms. The baseline jsp in tiles-def can't have an all-encompassing form.
Have you ever extended the form tag to include token tag by default or know of some library that does that?
I haven't explored Freemarker template, so do not know if this is feasible or not. If there are no existing solution, I'll try to build my own.
To consolidate from the comments section,
1) Create a new theme
2) Extend "form-close.ftl" to this
<#s.token/>
<#include "/${parameters.templateDir}/xhtml/form-close.ftl" />
Add tokenSession (or token) interceptor in your stack.
With these changes, all struts forms will have a struts-token added without specifying <s:token> in each of them.
In grails it is easy to add tokens to prevent form double submission and also the click hijacking.
Just add useToken="true" to the form tag:
<g:form ... useToken="true" >
But, this is not available for formRemote tag. I know that I can do normal form and write js code to transform them into ajax froms with token, but because of that is odd that is not supported by default in the formRemote tag.
Any reason for this, or is just (another) bug in Grails?
Are there any way to call spring webflow action at primefaces in p:selectOneMenu?
There are two dependent combobox like as primefaces example.(link) But i want to call action which is defined at webflow transtion therefore i could not use p:ajax with actionlistener.
After search,i tried to use p:remoteCommand to call action.It execute action when parent combo change,but it also give captcha validation error (captcha at same form),therefore i set process="#this" to p:remoteCommand, when i set that i could not execute action.
You should be using remoteCommand to invoke SWF action. If you only want to submit a value for some components you can use process="componentIds" to send only the values of specified components. You may also want 'immediate=true' on the remoteCommand to skip JSF validation - this should stop error messages from captcha validation.
However, in my experience its not a good idea to use SWF actions for tasks like refreshing dependent comboboxes. Primefaces partial rendering is much better suited for this, and does not require gimmicks like SWF tags.
Please post your XML if immediate=true does not work.
I created a form using Orbeon form builder, and i included in its form instance the content of an xml file using :
<xi:include href="oxf:/path/file.xml" xxi:omit-xml-base="true" />
When i save the form in form builder and edit it, i get a new form, and when i publish it and run it in form runner i get a blank page.
Can you tell me please what's wrong with the xi:include ?
If you want to include the whole content of an external file as the instance, use:
<xforms:instance id="main-model-instance" src="oxf:/path/file.xml"/>
Here we have the model instance xml in external file at /path/file.xml and we are using this file into our form and have named the model instance as id="main-model-instance"
If you need to add part of the instance from external file, then insert that piece dynamically during xforms-model-construct-done event, e.g.:
<xforms:action ev:event="xforms-model-construct-done">
<!-- Extracts the element some-section from file.xml and uses it as the
root element of the fr-form-instance -->
<xforms:insert context="instance('fr-form-instance')"
origin="doc('oxf:/path/file.xml')/root-element/some-section" />
</xforms:action>
i want to know that How we will enable front-end validation based on the xml in validation.xml?
If you're using one of the themes that supports front-end validation (like css_xhtml), you should just have to set validate="true" on your tag. That should generate the javascript function from your validation.xml (or ActionName-validation.xml) and call it in an onSubmit handler.