form-builder embedding parameters, buttons and processes

26 views
Skip to first unread message

Patxi Alba

unread,
May 22, 2020, 9:07:36 AM5/22/20
to Orbeon Forms
Hello,

Is it possible to parameterize the form-builder embedded in the Java API, to give the name of the app and form, in the API headers?

<%    
    HashMap<StringStringmapa = new HashMap<StringString>();       
    
    mapa.put("app""Proves");
    mapa.put("form""test");
    
        API.embedFormJava(
            request,            // HttpServletRequest: incoming HttpServletRequest
            out,                // Writer: where the embedded form is written
            "orbeon",    // String: Form Runner app name
            "builder",          // String: Form Runner form name
            "new",              // String: Form Runner action name
            null,               // String: Form Runner document id (optional)
            null,               // String: query string (optional)
            mapa                // Map<String, String>: custom HTTP headers (optional)
        );
%>


Another question would be the consequences of changing the orbeon / builder buttons and processes in properties-local.xml.

I have managed to show only the save button and have it send a document-id to the servlet, and redirect to another page from the servlet.

Not seeing it in the documentation my question is about the consequences of doing this?

Is there any "then publish" metod?

Greetings and thanks.

<!-- Proves de parametritzar el form-builder -->
    <property as="xs:string" name="oxf.fr.detail.buttons.orbeon.builder">
        save-final
    </property>

<property as="xs:string" name="oxf.fr.detail.process.save-final.orbeon.builder">
    require-valid
    <!--        then email-->
    then save
    then send(
        uri        = "http://localhost:8080/formularis/ServletRepBuilder",
        method     = "POST",
        content    = "xml",
        replace    = "all"
    )
/>

Alessandro Vernet

unread,
May 25, 2020, 2:24:50 PM5/25/20
to orb...@googlegroups.com
Are you saying that you'd like to embed Form Builder, and would like to
provide the app/form name so users don't have to type it in the dialog that
shows up when you load Form Builder? If so, try passing them as request
parameters, in the query string, which is the 7th parameter to
`API.embedFormJava()`, just before the headers.

Doing this without the embedding API, which is maybe clearer, looks like
this, and you'll notice that if you load this URL you'll get right into Form
Builder without having to enter the app/form name:

https://demo.orbeon.com/demo/fr/orbeon/builder/new?fr-app=my-app&fr-form=my-form

For more on this, see:
https://doc.orbeon.com/form-builder/advanced/extensibility/integration#bypassing-the-new-form-dialog

You'll let me know if this works for you,

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

Patxi Alba

unread,
May 26, 2020, 5:38:50 AM5/26/20
to Orbeon Forms
Yes, this works.

Is it possible to modify the buttons and processes of the from-builder? For a button to save, publish and send the information of that form to a Servlet to use it?

I've only got these parameters with empty XML, I don't know if this integration is possible.

Parameters received in the servlet

{app=[orbeon], form=[builder], form-version=[1], document=[27835e22478afebaf22f11399fe03f94a8d546a8], valid=[true], language=[en], process=[a49008ecc675e9f5be622166eaaab5fa051a5390], data-format-version=[4.0.0]}

Alessandro Vernet

unread,
May 26, 2020, 11:49:29 PM5/26/20
to orb...@googlegroups.com
Mmh… it is not completely impossible, but it is tricky to run something after
the form has been published. What is your use case? What do you need to do
with the form after it is published?

Alessandro Vernet

unread,
Jun 3, 2020, 12:38:44 AM6/3/20
to orb...@googlegroups.com
Have you found a way to do what you wanted on publish? Or, if not, do you
have any feedback about my question on your use case?

Patxi Alba

unread,
Jun 3, 2020, 4:12:21 AM6/3/20
to Orbeon Forms
Yes, I have found an alternative way to do it.

- I redirect to servlet with save button.
- With the $document-id that I receive, I publish the form with the API.
- Parsing the response XML to get the app-name and form-name.

But now I have new doubts.
I have created a cancel button in the form-builder, can orbeon redirect to the page where the user comes from? Or do I do it from a servlet?

The other question is: can I (when embedding the form-builder) specify the language of the form, as I would do with the app i form in the query?

Greetings and thanks.

Alessandro Vernet

unread,
Jun 3, 2020, 6:00:41 PM6/3/20
to orb...@googlegroups.com
Excellent, that's a good way to do it; I hadn't thought about it :).

> I have created a cancel button in the form-builder, can orbeon redirect to
> the
> page where the user comes from? Or do I do it from a servlet?

When the button is pressed, you could run some JavaScript that issues a
browser back. But that wouldn't work if the user opened the page in a new
tab. It seems to me that it would be better if can find a more predictable
way to find where to take the user in cases they press "Cancel", and
navigate to that place more explicitly. Maybe the caller of the embedding
API can pass that information to the form in an HTTP header or request
parameter, you can store it in a Hidden Field, and navigate to the value of
that field?

> The other question is: can I (when embedding the form-builder) specify the
> language
> of the form, as I would do with the app i form in the query?

Try passing the `fr-language` request parameter in the query string
parameter. Also see:
https://doc.orbeon.com/form-runner/features/localization#determination-of-the-forms-language

Patxi Alba

unread,
Jun 8, 2020, 8:44:19 AM6/8/20
to Orbeon Forms
Thanks for the answers.

The JS method would serve us. But I have not found the way to execute a JS on a button of the form-builder, how would it be done?

Alessandro Vernet

unread,
Jun 8, 2020, 2:47:55 PM6/8/20
to orb...@googlegroups.com
Hi,

You can run JavaScript through the `navigate()` action (see link below).
You'll let me know if this works for you.

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner#navigate

Patxi Alba

unread,
Jun 9, 2020, 7:17:26 AM6/9/20
to Orbeon Forms
Yes, this works, thanks.

Another question. When passing the language parameter, can one not directly supported be passed? 

For example Catalan. I have tried without result with ca, cat, etc. What parameter would it be? if possible. 

Alessandro Vernet

unread,
Jun 9, 2020, 1:42:59 PM6/9/20
to orb...@googlegroups.com
Hi,

Orbeon Forms uses 2 letter codes (ISO 639-1), so for Catalan use "ca". And
we currently don't have Form Runner localized in Catalan, but would love to.
I've put a link below to a page with more information about this, and if
you're ok with it, you can also contribute your localization so it can ship
out-of-the-box in future versions of the product.

https://doc.orbeon.com/contributors/localizing-orbeon-forms

And you can pass the language explicitly with the `fr-language=ca` request
parameter in the query string
parameter.

https://doc.orbeon.com/form-runner/features/localization#determination-of-the-forms-language

Patxi Alba

unread,
Jun 10, 2020, 3:55:00 AM6/10/20
to Orbeon Forms
Can the red part of the image be in Catalan with the query parameter?
I could not do it

form-runner-not-ca.jpg


Alessandro Vernet

unread,
Jun 11, 2020, 8:44:00 PM6/11/20
to orb...@googlegroups.com
This is because you created an English form. Instead, you need to create a
form in Catalan. With Orbeon Forms PE, you can have a single form in
multiple languages. With Orbeon Forms CE, only one language per form is
supported. For more on this, see:

https://doc.orbeon.com/form-builder/localization

Now, you can’t just use Catalan in Form Builder, because it isn’t one of the
supported languages. First, you’ll want to localize Form Runner in Catalan.
You’ll find more information about that in the 1st page linked below. Then
you can add “ca” to the available languages, and set it as the default
language.

https://doc.orbeon.com/contributors/localizing-orbeon-forms
https://doc.orbeon.com/configuration/properties/form-runner#available-languages
https://doc.orbeon.com/configuration/properties/form-runner#default-language

Does this sound like a plan?

-Alex

Patxi Alba

unread,
Jun 12, 2020, 7:20:37 AM6/12/20
to Orbeon Forms
I will continue to review the information.

Thank you for answering my questions.

Alessandro Vernet

unread,
Jun 19, 2020, 8:43:53 PM6/19/20
to orb...@googlegroups.com
Sounds good, and of course just let us know if you encounter any difficulty
localizing Form Runner in Catalan.

‑Alex
Reply all
Reply to author
Forward
0 new messages