Orbeon Forms: Read the Browser URL in Form Runner Mode - orbeon

How can I read the browser URL in Form Runner mode?
Many thanks in advance..
See example here
I've tried using a few XXF: functions, but none appear to work.

I think the function you're looking for is fr:form-runner-link() (doc).
It also takes as a parameter for you to say whether you'd like the link to take users to the page to create new data with this form, or to edit the current data, and more. This function is available since Orbeon Forms 2022.1, which, at the time of this writing, is planned for release in the next few weeks.

Related

Form submit with the form context in HTMLUnit

I have a project where I am converting some old HTTPUnit code to HTMLUnit. Among one of the issues I have ran into is the form.submit() option of HTTPUnit.The form.submit works without having to specifically finding the submit button for that particular form provided I have selected the correct form while initializing the form variable earlier.
Is there something similar in HTMLUnit that I could use?
Just to explain the significance of what I am asking, I am testing a shopping site with several forms (for different product) and each form has it own form button with no specific attribute to separate them. Every form has its own different structure and hence finding the submit button using xpath is a bit difficult.
Specifically what I am asking is there a way in HTMLUnit where I could submit a form on basis of the form itself and not the specific submit button? And if not given the above circumstances could anybody please suggest a workaround?
Thanks in advance.

ASP.NET MVC 4.0 Chrome Caching

I have code in place to disable caching in my MVC application. I'm using the following response headers. They seem to work in all browsers except for Chrome (currently using version 31.0.1650.48). Users are able to submit a form with model values. When they hit the back button I need the page to reload with a blank model. The headers appear to partially work since the request is hitting the action and returning the blank model. However the view isn't updating. The values from the previous post are being retained. I've tried clearing the ModelState but that doesn't work. Any suggestions? Thanks in advance!!
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(False)
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache)
filterContext.HttpContext.Response.Cache.SetNoStore()
Turning off autocomplete for the form fixed this for me. I appreciate all the input!
<form autocomplete="off"></form>
There is a way to do this in javascript for everything in one go like so...
document.getElementById("YourFormID").reset();
Just add an id to your form and all your inputs will reset on page load. Regardless if its a first time visit or a back button click with the page being cached. The biggest difference from your solution and this is that "the autocomplete attribute is new in HTML5". Which means it is not supported in older browsers, and though it does what you want it also prevents the user from autofilling fields. Meaning that for example on text types inputs users will not see a suggestion of words they may have entered on previous or other pages. You can see an example here.

Update form based on dropdown selection

I'm new to Rails and I'm trying to figure out how to change either the fields in the form, or the form itself, based on the selection of a drop down menu. I have thought about using AJAX, or about embedded Ruby within the form. Any direction would be great.
Well, obviously there will be javascripts involved at some point.
I think there are 2 solutions for you to choose from:
using ajax to fetch the new data to change your form upon dropdown changes
loading everything you need from the first time (when landing to the page) and then displayhing/hiding things only using javascript
Starting from this, I suppose your decision will be made depending if you want/can afford loading everything you need from the beginning... and if not you'll probably go with ajax.
Let us know if you need some more details. : )

Add Submit button on Orbeon Form Runner and then call custom Java REST API on submission

I am working on a POC (proof of concept) where I am evaluating Orbeon form builder/runner. I am using community edition, just in case, I will need to change the code, else the Professional Edition would do for POC.
I am integrating FormRunner with my web application running on different web server, which will call the FormRunner URL with some custom query parameters.
I want to remove the Summary, PDF and Review buttons from FormRunner and simply want the save button to function as submit button, so as clicking on it will submit the POST data to my custom Java code which will talk back to my web application, likely through REST API. The submit button then should redirect me to another page saying 'Your data has been submitted'.
I find it difficult to understand the area where I can change the code for expected behavior. Could you provide me some pointers in this regards please?
Thanks and Regards,
Mayuresh.
You shouldn't have to change the code for this, but instead use the oxf.fr.detail.buttons.*.* property to define which buttons are shown. Based on your description, you only need the workflow-send button, which, amongst other things can POST the form data to a service you specify.

Flash and ASP.NET MVC to post data to server

what design approach would you take for security and scalability (and perhaps level of effort) when posting an ASP.NET MVC HTML form that also has a Flash component, as described in the scenario below?
I have a scenario where there's an ASP.NET MVC site, and a page that requires user authentication & authorization to access (using ASP.NET forms authentication). On that page there's an HTML form. The form also has a Flash component. The form has a few text fields, and the Flash component has binary data that needs to get submitted to the server in tandem with the HTML form fields. When the user hits the submit button on the HTML form, the form contents and binary data from the Flash need to get submitted as part of one atomic unit, so to speak.
I know that I can use HTML / Flash JavaScript bridging to post the form either through JavaScript, or through the Flash component. I could even do both, perhaps posting the binary data from the Flash component when the user clicks submit, and then posting the HTML form content following that.
From your experience, what approach would be the path of least resistance to post the form with? Considering the user authentication and authorization part, I imagine that Flash would higher effort than HTML. What about the user authentication aspect? If the page posted from Flash to the server, would Flash also have to authenticate the user, in addition to the standard HTML authentication form?
My Flash binary data should not typically be greater than 300KB, often less...any opinions / insights are greatly appreciated!
EDIT:
I also vaguely remember that with Flash 10.1, ExternalInterface seemed to not work right when transferring binary data to JavaScript, am I mistaken with that, and that you can easily transfer 300KB or more of binary data from Flash to a JavaScript variable that is then posted to the server?
Thanks!
That's one way of doing it:
Make your flash component call a javascript function through ExternalInterface.call().
Make the called javascript function change a hidden field inside the form.
When the form is posted, the hidden field will send the desired value to the server.
I guess this is also the safest way - since the Flash component will not communicate with the server. Everything you need is a standard, non-AJAX form post.
Edit
Sorry, I guess I should have paid more attention... If there is too much data being sent from the flash component, maybe you should post it directly to the server.
Still, you could use ExternalInterface to synchronize the whole process. Make Flash call a server-side method (I would use FluorineFX for that, but your opinion may vary). Then .NET will return an ID, meaning it has received and saved the binary data for future use. Then call ExternalInterface to set that ID to a hidden field. After that, when the HTML is posted to the server, the server-side action method just need to retrieve the binary data using the posted ID...
The problem here is that you will end up with some binary data that will never be associated to any form post... But that's OK I guess, just run some "garbage-collector" script from time to time.
About the authentication issue: FluorineFX does implement .NET authentication, and it is able to retrieve the current logged in user. Of course, there are some issues.

Resources