Orbeon Forms: Inhibit Data Entry after Form is Completed - orbeon

Sorry for the basic question... I'm relatively new to Orbeon Forms..
Is it possible to inhibit the change of a form (to most users) once the has been submitted and the status has reached the "Completed" ?
Specific business key users must be able to change these forms if required (like Admin rights).
At present anyone with the right permissions can re-open a form and change the data..
Many thanks
PeteA

The basic idea is the following:
In the process that runs when users submit the form, use the set-workflow-stage(name = "…") action to change the workflow stage to something like submitted.
In Form Builder, set the entire form to be readonly if the workflow stage is submitted using a formula like fr:workflow-stage-value() = 'submitted'.
You can find more about it in this blog post.

Related

Form settings validation (application and form name uniqueness)

From the Orbeon documentation:
Application Name. Each form definition has an application name which identifies a group of forms that belong together. In practice, an application name might correspond to a project, or a department, or a company. For example, all forms built by Orbeon have the "orbeon" application name.
NOTE: Depending on your permissions, the application name might have been picked for you already, or you might have the choice of a restricted set of application names.
Form Name. Each form definition also has a form name, which identifies a unique form name within a particular application.
As orbeon's persistence API retrieves the form definitions by their application and form name, I would like to put some validation to the form settings page that would prevent the user to save a second from definition with the same application and form name as an existing one.
(My first approach would be to put some custom response to the persistence layer, but orbeon is not able to make difference between a general persistence error and a validation errror there with other words the backpropagation of the errors of the persistence layer/api to the user is not that mature, so to say.)
So how should I do this?
If I understand correctly, you'd like Form Builder users to be prevented from creating a new form with an app/form name that is already used. The user could either be prevented from creating that form, or at least offered the option of opening the existing form instead of creating a new one with the same app/form name.
One question would be what, in that context, "already used" means: are we talking about forms editable by that user in Form Builder, or published forms? Maybe Form Builder should check both.
This check should happen in 3 places in Form Builder:
When the form is initially created (better warn users as soon as possible).
When users open the form settings dialogue to rename the form.
When saving (even if we're sure no form with the same app/name existed at the time the form was created, in the meantime another form with the same app/name might have been created).
In situation number one, if a form with the same app/name exists in Form Builder, Form Builder should provide the user the option to open that form instead of creating a new form.
So this is a feature that should be implemented at the level of Form Builder; it cannot be done solely by a custom implementation of the persistence API. This is covered by request for enhancement #818.

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.

multi-step registration

I am currently using sfDoctrineGuardPlugin and sfDoctrineForkedApplyPlugin for my user management.
This works well for me and users can register/login etc
The problem comes with the registration part. The Profile relation that I have is getting particularly large in terms of fields users are required to fill out on registration.
I was thinking of possibly creating a multistep process, possibly 2 steps.
Step 1 is the main details, such as name, username, password etc
Step 2 is the address and my other fields
I don't want my users to scroll down to fill out 25 fields on a single form
I'm not entirely sure how I'd do this and I cannot find any information regarding carrying out this.
Has anyone ever done this before and If so, could someone point me in the right direction of how I'd do this?
Thanks
I'd create a form class for every step. When processing the submitted form, save the submitted part to the session if validation passes.
In the end you'll have an array of validated values for every step, just compose your model object out of them, and save the object.
Here is a generic way of handling multi-step forms in Symfony:
How to 'validate' a Symfony form in steps - instead of calling $form->isValid()

If two forms in a view, how to pass both sets of params when one is submitted?

I have a view with two forms. A main form to create a new contact and another form to add a new folder (for organization).
Is it possible to get params for both forms to be set when one of the forms is submitted? Say, if a new folder is created I'd like to return to the view with any filled out contact information still there (or the other way around if the main form has errors).
Thanks!
It's a basic constraint of HTTP that a form submission only includes the values for the submitted form (which is, of course, a feature, not a bug).
Options to actually deal with your need:
If the two forms go to the same place, you could of course simply make them one big form; they can look like two forms visually without being two forms within the page
You could use javascript to populate one form with hidden fields representing the values in the other form. These could be updated either whenever the values change, or just before the actual submission takes place
Or (and this is what you should do, in my opinion) you could make both forms submit via AJAX rather then submitting the full page. That way, the form that hasn't been submitted won't change anyway, and there won't be any need to restore the values.

Parameters through postback

I'm working with Ruby on rails 2.3.4 and I'd like to pass some parameters from one page to another ones the first one is submitted.
For example:
On the first page, I have a form that when it's filled a Preview button can be clicked to check all the info entered before submitting the form. That button redirects to another page with the info entered before, but I don't know how to get it in the second page.
There are two possible solutions:
You can emulate the stepped form filling by creating a record in first form and saving it with status "unverified" or "pending". This way you won't have to deal with hidden form fields in 2nd and 3rd pages. All you'll need to pass is the id of pending record. You'll just need to update record status to "active" once the data is confirmed.
Use client side paginated from (all popular JS frameworks have plugins for this). Hence you will only display different <div>s in single loaded page (something like an interface for a setup wizard).

Resources