Using captcha on Orbeon form - orbeon

Here is the form I created on the Orbeon website:
http://demo.orbeon.com/demo/fr/orbeon/builder/edit/0860411ecf1bff6128bd802784ee22a33b0bab68
I can display captcha but seems it's not validated when I run the form and move to the next page (this is a multi-page form). Anything else that I missed?
Here is the captcha code, added by editing source code of form builder
<fr:simple-captcha id="my-captcha">
<xf:send ev:event="fr-verify-done" submission="save-submission"/>
<xf:action ev:event="fr-verify-error">
<xf:toggle case="failure-case"/>
<xf:dispatch target="my-captcha" name="fr-reload"/>
</xf:action>
</fr:simple-captcha>`

Related

orbeon form user can submit twice.Can we have a loading indicator for a process in properties-local.xml?

I have an orbeon form which has custom button to submit and The user can submit it twice because there no spinner showing up when he submits and he has ample of time to click the button many times.Can we disable the the submit button when clicked
Visbility formula:xxf:instance('fr-form-instance')/*/status!='Submitted'
form xml:
<xf:label ref="$form-resources/cps-submit-btn/label"/>
<xf:hint ref="$form-resources/cps-submit-btn/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:trigger>
<xf:action ev:event="DOMActivate" ev:observer="cps-submit-btn-control">
</xf:action>
<xf:action xmlns:process="java:org.orbeon.oxf.fr.SimpleProcess" ev:event="DOMActivate"
ev:observer="cps-submit-btn-control"
type="xpath">
xxf:instance('fr-form-instance')/process:runProcessByName('oxf.fr.detail.process', 'send-CPS')
</xf:action>
Vesrion 4.6PE
Since Orbeon Forms 2016.1 (formerly known as 4.11), you can choose for each button if you'd like to have:
a spinner inside the button, without blocking user's input, called the inline loading indicator;
a spinner in the middle of the page, blocking user's input, called the modal loading indicator;
no spinner at all.
It looks like, for the specific button you're referring to, you are looking for option 2 above. If this is indeed the case, then I would recommend, if possible, to upgradied your Orbeon Forms so you can benefit from this feature.
And for more about this, see the blog post: How do you tell users "something is going on"?

Stop prompt to leave unsaved form on Form Runner

We are using Form Runner inside another web application (by loading a form into an iframe). The other web application has session timeout functionality to require the user to log back in after a certain number of minutes.
When the form is loaded in the application, the session timeout does not work (can't change the page), because Form Runner is prompting asking if the user is sure they want to leave the page (as the form is not saved).
We currently do not want to save any existing data on timeout, so don't mind that data is lost (not a very big form).
Is there a way to disable this prompting on unload?
Kudos to #orbeon for pointing out the file which defines the beforeUnload function.
The prompt is created through the window beforeUnload event, which in Orbeon Form Runner is set in the check_dirty_script.xhtml. It can be easily overridden by resetting the window.onbeforeunload once the form has been loaded. To do it in your form, attach a script to the xforms-ready event:
...
<xf:model...>
....
<xf:action ev:event="xforms-ready">
<xxf:script>
window.onbeforeunload = null;
</xxf:script>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
....

Trigger Javascript, Java, or a Bash Script on submit in Orbeon?

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.

Orbeon 4.3 doesn't seem to allow creation of new form with given ID

We have an application that creates new form runner forms in Orbeon. This is done by opening the URL to the form runner form.
Example:
http://server.com/orbeon/fr/[APP_NAME]/[FORM_NAME]/new/[new id]
In 3.8 and 3.9 we where able to give the [new id] and Orbeon would create a new form with the given ID.
In 4.3 however it doesn't seem to accept the [new id] any more.
We get this message in the browser:
You do not have access to this page.
It does allow us to generate new forms by using this url:
http://server.com/orbeon/fr/[APP_NAME]/[FORM_NAME]/new
But this doesn't give us control over the ID anymore.
We use the standard Exist persistence layer.
I'm not sure about the differences between 3.4 and 4.3, but in 4.3 the id can be passed as a URL parameter and then set using an action.
For example:
http://server.com/orbeon/fr/[APP_NAME]/[FORM_NAME]/new?document-id=[new id]
and include an action in the form definition:
<xf:model>
...
<xf:action id="populate-document-id-binding">
<xf:action ev:event="xforms-ready" ev:observer="fr-form-model" if="($fr-mode='new') and (xxf:get-request-parameter('document-id')!='')">
<xf:setvalue model="fr-parameters-model" ref="instance('fr-parameters-instance')/document" value="xxf:get-request-parameter('document-id')"/>
</xf:action>
</xf:action>
...
</xf:model>
This assumes you're happy with editing the form definition source.
DISCLAIMER: I don't know the road-map for the document parameter, so can't say how supportable this is going forward.

Grails form token not available for ajax forms?

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?

Resources