Orbeon Form Builder - button with hyperlink with dynamic url

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Orbeon Form Builder - button with hyperlink with dynamic url

Romek
Hi I'm completely new in orbeon action buttons. In Form Builder, I'd like to
be able to add a hyperlink control to a form, where the target URL (open in
a new window) is constructed partially from values available in other form
fields. When I add a button i have a source code:
<xh:td>
                                <fr:changeValueButton
xmlns:exf="http://www.exforms.org/exf/1-0"
                                                     
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                                     
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                                                      id="test-control"
                                                      from=""
                                                      to=""
                                                      buttonLabel="label"
                                                      bind="test-bind"
                                                      class="">
                                                                       <xforms:label
ref="$form-resources/test/label"/>
                                                                       <xforms:hint
ref="$form-resources/test/hint"/>
                                    <xf:alert
ref="$fr-resources/detail/labels/alert"/>
                                                            </fr:changeValueButton>
                            </xh:td>

I tried to follow some links like
https://stackoverflow.com/questions/21102328/orbeon-form-builder-hyperlink-with-dynamic-url
but i cannot force this button to open new site.
How to do it?
thanks
Romek

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1581672126828-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
Hi Romek,

We have an RFE to provide better support for this (#2037), on which I added
a +1 from you. For now, you'll need to do what follows. Start by adding a
"Calculated Value" control, and in the Control Settings / Formulas /
Calculated Value write the XPath to produce the HTML ` `. It will be
something like:

    concat(
        ' Click me <https://www.google.com/',
        $other-field-name,
        '>  '
    )

You can then test the form, and check the produced HTML is correct:
html-link.png <http://discuss.orbeon.com/file/t119778/html-link.png>  

Finally, edit the source of the form, locate the `<xf:output>` corresponding
to your Calculated Value, and add the attribute `mediatype="text/html"`.
(And we don't expose this last step in the UI, as if not done properly this
opens the door to possible script injections.)

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/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1581729141406-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
Mmh, the snippet in my previous message got mangled. So here is an image
instead:
xpath-generating-a.png
<http://discuss.orbeon.com/file/t119778/xpath-generating-a.png>  

‑Alex

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1581729251882-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Romek
I dont have Calculated Value control but I did it with Text output control
and it works great!
Thank You for Your help
Best regards
Romek

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1581932158986-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
Hi Romek, perfect. And sorry, I mean to refer to the Hidden Field control,
which was added in Orbeon Forms 2018.2, and before that you can indeed use a
Text Field, that you hide with Visibility under Formulas in the Control
Settings.

https://blog.orbeon.com/2019/02/hidden-fields.html

‑Alex

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1581967960269-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Romek
Alex is it possible to open this link in a new tab? Now it open link in the
same tab and its not easy to go back to form.
best regards
Romek Mendaluk

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582014802453-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
Hi Romek,

Yes: adding the attribute `target="_blank"` on that ` ` you create should do
the trick.

‑Alex

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582069099472-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Romek
I have added this attribute in my form source but nothing changed

This is my control
xh:td>
                                <xf:output bind="sprawa-bind"
id="sprawa-control" mediatype="text/html" target="_blank"
                                           class="">
                                    <xf:label
ref="$form-resources/sprawa/label"/>
                                    <xf:hint
ref="$form-resources/sprawa/hint"/>
                                    <xf:alert
ref="$fr-resources/detail/labels/alert"/>
                                   
                                </xf:output>
                            </xh:td>

I did it correct?


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582124821974-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
Hi Romek,

Sorry for the confusion: the `target="_blank"` goes win the ` ` you generate
with XPath, along those lines:

https://gist.github.com/avernet/2a2c50d84116f2337b68c4c6acc730cc

‑Alex

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582153357599-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Romek
Thanks, now it works great!!!

Romek

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582192541686-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
Perfect Romek, and thank you for the confirmation!

‑Alex

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582238895639-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon Form Builder - button with hyperlink with dynamic url

Alessandro  Vernet
Administrator
And Romek, I also added a +1 from you on request for enhancement #2037.

https://github.com/orbeon/orbeon-forms/issues/2037

‑Alex

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1584985089651-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet