API embedForm problem

136 views
Skip to first unread message

Andrzej Kaczówka

unread,
Oct 21, 2020, 4:32:46 AM10/21/20
to Orbeon Forms
Hi everyone,

I have a problem with embeding Orbeon form by using ORBEON.fr.API.embedForm.
Simply code html:
<html>
<head>
<script type="text/javascript"  src="/orbeon/xforms-server/baseline.js?updates=fr"></script>
</head>
<body class="orbeon">form:
<form method="post" action="/">
<div id="f" class="orbeon" style="width:100px;height:600px"></div>
</form>
<script>
ORBEON.fr.API.embedForm(
document.getElementById('f'),
"/orbeon",
"wniosek",
"andrzej-test",
"new");
</script>
</body>
</html>

Redirect in .htaccess is placed, the orbeon form display on the page but there are a few problems:
It's look like that:


Bottom part of the page:


On the console there are one problem:


while other many js files are read correctly.

Button "Save" doesn't work too. Do not do any action.

When I run URL of the new form which this script execute, the form is displayed correctly and all button actions work properly.

Embeded form doesn't work properly. Where could be the problem?

Thanks form help.


Alessandro Vernet

unread,
Oct 21, 2020, 6:32:04 PM10/21/20
to orb...@googlegroups.com
Hi Andrzej,

I cannot see your screenshots, but the embedding API is a PE feature
officially available since 2020.1, which hasn't been released yet. So you'd
need a pre-release of 2020.1 PE to test this. Are you using one already? If
not, just let me know if you'd like me to send you one.

‑Alex

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

Andrzej Kaczówka

unread,
Oct 22, 2020, 3:26:17 AM10/22/20
to Orbeon Forms
Hi Alex,

I'm currently using PE downloaded as a free trial version available on the orbeon page: 2019.2.2

Please send mi a link to the newest version PE if you can.

Many thanks.
Andrzej

Alessandro Vernet

unread,
Oct 22, 2020, 4:39:27 PM10/22/20
to orb...@googlegroups.com
Hi Andrzej,

Here you go, and you'll let us know if this is causing you any trouble:

https://orbeon-builds.s3.amazonaws.com/orbeon/orbeon-forms-pe/4099/4099.1/build/distrib/orbeon-2020.1-SNAPSHOT.202010080359-PE.zip

Andrzej Kaczówka

unread,
Oct 23, 2020, 8:01:15 AM10/23/20
to Orbeon Forms
Hi Alex,

Many thanks for the link. After upgrading PE to the newest version, embed forms work very well! It solved the problem.
When can I expect a full stable version 2020?

I have two questions yet:
1. After saving a form, a data is stored in the database in pure xml form. Is it possible to generate xml with xsl style? How can I got xml with his visualization?
2. User who fill the form can save it as PDF file. Is it possible to generate the PDF file from the server side? Is it possible to do some action which to do it?

Best regards,
Andrzej

Andrzej Kaczówka

unread,
Oct 25, 2020, 1:09:53 PM10/25/20
to Orbeon Forms
Hi Alex,

I have an another question concerned embed form and queryString parameter.

I did it like that:
ORBEON.fr.API.embedForm(
document.getElementById('f'),
"/orbeon",
"wniosek",
"andrzej-test",
"new",
undefined,
"userid=12345"
);

The question is how to use variable 'userid' from queryString parameter in form during building it in Form Builder.

I've added an input control, in settings->Formulas I entered:
xxf:get-request-attribute('userid')
but after running form, value of that variable is not displayed.

How can I use given vars in queryString in builder?

Thanks for help.

Kind regards,
Andrzej

Alessandro Vernet

unread,
Oct 26, 2020, 12:37:17 PM10/26/20
to orb...@googlegroups.com
Hi Andrzej,

It is passed as a request parameter, so in the form you'll want to use
`xxf:get-request-parameter()`. You'll let me know if this works for you!

https://doc.orbeon.com/xforms/xpath/extension-functions/extension-http#xxf-get-request-parameter

Andrzej Kaczówka

unread,
Oct 26, 2020, 4:18:42 PM10/26/20
to Orbeon Forms
Hi Alex,

Thank for hint. Unfortunately, it still doesn't work...
I tried to set "Calculated value" as: xxf:get-request-parameter('userid')
then I tried to set "Initial value" the same way but in both cases on runned form as:

ORBEON.fr.API.embedForm(
document.getElementById('f'),
"/orbeon",
"wniosek",
"andrzej-test",
"new",
undefined,
"userid=12345"
);  

the value of input text is empty. Where I made a mistake?

Thanks for help,
Andrzej

Alessandro Vernet

unread,
Oct 27, 2020, 7:17:20 PM10/27/20
to orb...@googlegroups.com
Hi Andrzej,

Strange, I just tried, and it is working for me:

1. I created a form `orbeon/a` with a Calculated Value field as:
https://i.imgur.com/4TyhNV3.png.
2. I deployed the `orbeon-embedding.war` and changed the `index.jsp` to pass
`gaga=42`: https://i.imgur.com/gxWFUVx.png.
3. Loading http://localhost:8080/orbeon-embedding/?form=a, I see the value
of the request parameter I am passing: https://i.imgur.com/5Bgx9GA.png.

Do you see what could be different in your case?
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Alessandro Vernet

unread,
Oct 29, 2020, 1:00:41 AM10/29/20
to orb...@googlegroups.com
Hi Andrzej,

Ah, I've tested the Java API, not the JavaScript API; stupid me! So I can
reproduce the issue you're having when using the correct API. I've create
issue #4698, we will look into it, and will follow-up here when fixed.

https://github.com/orbeon/orbeon-forms/issues/4698
Message has been deleted

Alessandro Vernet

unread,
Oct 29, 2020, 8:24:52 PM10/29/20
to orb...@googlegroups.com
Hi Andrzej,

We are planning to make the release before the end of the year, so… in the
next 2 months! But I'll follow-up on this thread when we have fix for this,
and will post a new link to a build with the fix.
Message has been deleted

Alessandro Vernet

unread,
Oct 30, 2020, 1:47:55 PM10/30/20
to orb...@googlegroups.com
Hi Andrzej,

Indeed, the PDF and review, and anything that navigates to another page,
aren't supported. Those are the same limitations that we have for the Java
embedding API (see the last section on the page linked below).

https://doc.orbeon.com/form-runner/link-embed/java-api

- The case of the PDF should be simpler to solve, for both the Java and
JavaScript APIs.
- And loading the review page should also be solvable in the context of the
JavaScript API.

Is there one that you would need more than the other?

Andrzej Kaczówka

unread,
Oct 30, 2020, 2:15:27 PM10/30/20
to Orbeon Forms
Hi Alex,

Thanks for an explanation.

I'm in the beginning of the whole project so I'm not sure which functionality I need yet.
I already adopted a send action, which made a few operations like save xml, save meta to the server.

I think, generate PDF file is possible in other way, like execute well-formed url /fr/orbeon/app/form/pdf/docid, right?

If I have questions, and probably will, let me write to you.

--
Andrzej

Alessandro Vernet

unread,
Nov 2, 2020, 12:45:22 PM11/2/20
to orb...@googlegroups.com
Andrzej wrote
> If I have questions, and probably will, let me write to you.

Sounds good, Andrzej.

Alessandro Vernet

unread,
Nov 30, 2020, 2:56:31 PM11/30/20
to orb...@googlegroups.com
Hi Andrzej,

Here we go: issue #4698 is fixed, and you can now use pass a document id and
query string from the JavaScript embedding API. In case you'd like to test
this out, here is 2020.1 pre-release build that includes that fix.

https://orbeon-builds.s3.amazonaws.com/orbeon/orbeon-forms-pe/4170/4170.1/build/distrib/orbeon-2020.1-SNAPSHOT.202011301856-PE.zip

-Alex

Andrzej Kaczówka

unread,
Dec 14, 2020, 6:33:49 AM12/14/20
to Orbeon Forms
Hi Alex,

Frankly speaking I've just read the message from you :) Thanks for the
newest version. I'll install today and test it. I'll let you know how it
goes.

Thanks,
Andrzej  

Alessandro Vernet

unread,
Dec 14, 2020, 12:09:28 PM12/14/20
to orb...@googlegroups.com
Hi Andrzej,

No problem! And when you get a chance to test this, you'll just let me know
if you find any problem.
Reply all
Reply to author
Forward
0 new messages