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>
....
Related
In document I see that we can custom the flow in properties-local.xml, but it is only available for Publish button outside (not publish button in dialog)
The flow I intend to do:
In Form builder, user click publish
Publish dialog showed, user click publish button in dialog.
Then it will call api from my server to send info.
In properties-local.xml, I modified inside this part:
<property as="xs:string" name="oxf.fr.detail.process.publish.orbeon.builder"> </property>
with this code:
<!-- show publish dialog -->
xf:show(
dialog = "fb-publish-dialog",
app = "{xxf:instance('fb-form-instance')/xh:head/xf:model[#id = 'fr-form-model']/xf:instance[#id = 'fr-form-metadata']/*/application-name}",
form = "{xxf:instance('fb-form-instance')/xh:head/xf:model[#id = 'fr-form-model']/xf:instance[#id = 'fr-form-metadata']/*/form-name}"
)
<!-- expect when user click publish button in dialog will execute this code -->
then save
then send(
uri = "http://localhost:8000/api/getFormBuilderInfo",
replace = "all"
method = "POST",
content = "xml")
The problem I don't know how to hook into publish button in dialog. Because I want to make sure that it has stored in orbeon database in order to creating new in form runner with appName and formName (which I get through api: http://localhost:8000/api/getFormBuilderInfo).
As of this writing, it isn't possible to invoke code after the form is published.
As a workaround, you could hook your code in the publish process, but this process runs before the form is being published, specifically before the Form Builder user is presented with a dialog asking them for a confirmation to publish the form. So, there will be delay between the time your code is invoked and the time the form is actually published, and of course there is a chance the user closes the dialog without going ahead with the publication of the form.
So, in practice, to use this workaround, you would need to apply some kind of heuristic, like "when your code is invoked, register some a listener to run, say in 5 minutes; when that time has passed, check if the form was actually published, and if so do the action that you needed to perform".
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.
I am new to struts2. I am working on the struts2 with spring application.
I developed user registration functionality. In this registration process have the 3 steps(3forms). First page is step1 contains some fields, second page is step2 contain some other fields and step3 contains some other fields.I used session map in the action class to put the all field values of all forms.After submission form in step3 it goes to call rest service and give the response.If the response is OK then i am redirecting to success page step4. In some cases if user is already exits then it gives response existed user then am redirecting to step5 page. In this page i used one message " Sorry the user is already exists" and with one link "Home Page".
I used this link <s:a id="next" href="/sample/register/user.action"> Homepage </s:a> in step5 page. After clicking on this link it goes to homepage(means step1 page) fine,but it doesn't contain user entered values. I have to maintain all field values in the step1,step2,step3 process. How to achieve this problem.
Please any one can give suggestion.
IF you are using session map to persist values being entered by the user, i believe they should be available in the session until you have not removed them from the session or session expired.more over when you do redirect a new request -response cycle started by the framework and a new value stack will be created that means all old values will be lost.
From your description i believe you are creating a wizard like functionality and if this is the case i believe struts2 provide a more elegant and flexible solution
ScopeInterceptor
This is designed to solve a few simple issues related to wizard-like functionality in Struts
Still you need to show how you trying to show the values in the form being filled by the user if something fails or when user is already exists in the system as described in your case.In this case you need to fetch object/data from the session.
Here's the problem, I need to validate the form before submitting in the next way, before user can submit anything he should click "Save" button, if he tries to click "Submit" one receives message something like "You should save form before submit".
First I thought that I can add system field to the form like save-indicator, add constraint to like that
<xforms:bind id="isSaved-bind" nodeset="isSaved"
name="isSaved" type="xforms:string" constraint="number(.)=1" required="true()"/>
And add
<xforms:setvalue ref="xxforms:instance('fr-form-instance')/person/isSaved">1</xforms:setvalue>
to actions when "Save" button beeing clicked.
But, the problem is that I have to rewrite all existing forms to insert new code there.
Is there any posibility to make global variable like "isSaved" and check it for every form, before submit, and show error message if user didn't save form?
Or may be there another way that I can't see?
Will be appreciated for any answers.
Form Runner keeps track of whether the form is clean or dirty, and you can access that information in xxforms:instance('fr-persistence-instance')/data-status. The code handling the submit is in apps/fr/includes/persistence/persistence-model.xml. There you could change the listener for DOMActivate on fr-submit-button to read like:
<xforms:action ev:event="DOMActivate" ev:observer="fr-submit-button">
<xforms:action if="instance('fr-persistence-instance')/data-status = 'clean'">
<xforms:setvalue ref="instance('fr-persistence-instance')/submit-or-save-or-send">submit</xforms:setvalue>
<xforms:dispatch name="fr-save-action" target="fr-persistence-model">
<xxforms:context name="fr:check-data-valid" select="true()"/>
</xforms:dispatch>
</xforms:action>
<xforms:action if="instance('fr-persistence-instance')/data-status = 'dirty'">
<xforms:message>You must save form before submitting it.</xforms:message>
</xforms:action>
</xforms:action>
Note that persistence-model.xml is in orbeon-form-runner.jar. To change that file, extract it from there, and place it in the WEB-INF/resources/apps/fr/includes/persistence/persistence-model.xml. That version on WEB-INF/resources will take precedence over the one in the jar file. Also note that these type of changes that rely on the internals of Form Runner or Form Builder have a chance to break when upgrading to a new version of Orbeon Forms. So you might want to carefully keep track of them, so you can more easily reapply the changes when you upgrade.
I use a global flag indicator to check if the form is saved before closing the window or submit and it works pretty well.
This information is cleary explained in this wiki.
All the best!
I'm attempting to add a button to the Activities grid ribbon to open a modal window that shows all the activities with latlng data on a map.
I have this working ok for a small number of activities, but once the selected number grows too large CRM has problems opening the modal window.
My current theory is that this is because the parameter string is too long to be passed via the GET method.
Is there a way to pass the SelectedControlSelectedItemIds to the web resource using POST rather than GET? I can't see any in TN docs*, but I'm hoping someone might have found a way.
*http://technet.microsoft.com/en-us/library/gg309332.aspx
Here's a snippet of the code I have at the moment:
<CommandDefinition Id="Mscrm.Isv.activitypointer.HomepageGrid.Group0.Control0">
<EnableRules>
<EnableRule Id="Mscrm.Enabled" />
</EnableRules>
<DisplayRules />
<Actions>
<Url Address="$webresource:as_cam_mapsa" WinMode="1" PassParams="true" WinParams="dialogHeight: 800px; dialogWidth: 1000px">
<CrmParameter Name="data" Value="SelectedControlSelectedItemIds" />
</Url>
</Actions>
</CommandDefinition>
Instead of using a html webresource, you could could call a javascript function with no parameters from the ribbon. Inside this javascript you can use something like this to get the selected ids:
document.getElementById("crmGrid").control.get_selectedIds();
Now you can select if you want to use javascript / jQuery or another framework to build the whole dialog - or you can use showModalDialog in javascript to get the same dialog as crm uses. In any term you now have a litle bit more control on how the parameters are sendt.
You should also be able to use the code above inside your html webresources javascript by getting the parent window from dialogArguments that is sent by default to a modal dialog.
window.dialogArguments.window.document.getElementById("crmGrid").control.get_selectedIds();