is Html Page with XForm tags processed by Orbeon XForm engine?

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

is Html Page with XForm tags processed by Orbeon XForm engine?

Ketan
Hi All,

I am new to Orbeon Forms. I am working on CreditCardVerify XForm (Sample XFrom
provided by Orbeon Forms -- I removed xhtml and put html tag). Below is source
code for the same. This file contains HTML + XFORM. As I have put Html tag,
XForm tags are not processed by Orbeon XForm engine. But if I put XHTML +
XFORM, it works fine.


==Source Code for CreditCard XForm ==

<html>
    <head>
        <xforms:model id="main-model"
xmlns:xforms="http://www.w3.org/2002/xforms"
                        xmlns:xs="http://www.w3.org/2001/XMLSchema">

            <xforms:instance id="credit-card-instance">
                <credit-card>
                    <type>visa</type>
                    <number/>
                    <expiration-month/>
                    <expiration-year/>
                    <verification-code/>
                    <valid>false</valid>
                </credit-card>      
            </xforms:instance>

            <!-- Validate credit card number -->
            <xforms:bind nodeset="number" type="xs:integer" constraint="
                (
                    (/credit-card/type = 'visa'
                        and (string-length(/credit-card/number) = 13 or
string-length(/credit-card/number) = 16)
                        and starts-with(/credit-card/number, '4'))
                    or (/credit-card/type = 'mastercard'
                        and string-length(/credit-card/number) = 16
                        and (starts-with(/credit-card/number, '51') or
starts-with(/credit-card/number, '52')
                            or starts-with(/credit-card/number, '53') or
starts-with(/credit-card/number, '54')
                            or starts-with(/credit-card/number, '55')))
                    or (/credit-card/type = 'amex'
                        and string-length(/credit-card/number) = 15
                        and (starts-with(/credit-card/number, '34') or
starts-with(/credit-card/number, '37')))
                )
                and
                    (for $mult-number in
                        string-join(
                            for $i in 1 to string-length(/credit-card/number)
return
                            for $digit in substring(/credit-card/number, $i, 1)
return
                            if ($i mod 2 = 1) then xs:string(xs:integer($digit)
* 2) else $digit,
                            ''
                        )
                    return
                        for $sum in
                            sum(
                                for $i in 1 to string-length($mult-number)
                                return xs:integer(substring($mult-number, $i,
1))
                            )
                        return $sum mod 10 = 0)
                "/>

            <!-- Check expiration month/year -->
            <xforms:bind nodeset="expiration-month"
                    constraint=". castable as xs:integer and . >= 1 and 12 >=
."/>
            <xforms:bind nodeset="expiration-year"
                    constraint=". castable as xs:positiveInteger and
string-length(.) = 4"/>

            <!-- Only display verification code for Visa and MasterCard -->
            <xforms:bind nodeset="verification-code" relevant="../type = 'visa'
or ../type = 'mastercard'"
                    constraint="/credit-card/type = ('visa', 'mastercard') and
. castable as xs:positiveInteger"/>

        </xforms:model>
       
    </head>
    <body>
        <xforms:group ref="/credit-card"
xmlns:xforms="http://www.w3.org/2002/xforms"
                        xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <table border="0" cellpadding="2" cellspacing="0">
                <tr>
                    <td align="right">Card type:</td>
                    <td>
                        <xforms:select1 ref="type" appearance="minimal">
                            <xforms:item>
                                <xforms:label>Visa</xforms:label>
                                <xforms:value>visa</xforms:value>
                            </xforms:item>
                            <xforms:item>
                                <xforms:label>Mastercard</xforms:label>
                                <xforms:value>mastercard</xforms:value>
                            </xforms:item>
                            <xforms:item>
                                <xforms:label>American Express</xforms:label>
                                <xforms:value>amex</xforms:value>
                            </xforms:item>
                        </xforms:select1>
                    </td>
                </tr>
                <tr>
                    <td align="right">Number:</td>
                    <td>
                        <xforms:input ref="number">
                            <xforms:alert>No alphabetical characters or signs
are allowed in credit card number</xforms:alert>
                        </xforms:input>
                    </td>
                </tr>
                <tr>
                    <td align="right">Expiration month:</td>
                    <td>
                        <xforms:input ref="expiration-month" style="width:
2em">
                            <xforms:alert>Expiration month must be between 1
and 12</xforms:alert>
                        </xforms:input>
                    </td>
                </tr>
                <tr>
                    <td align="right">Expiration year:</td>
                    <td>
                        <xforms:input ref="expiration-year" style="width: 4em">
                            <xforms:alert>Expiration year must be a 4 digit
number</xforms:alert>
                        </xforms:input>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <xforms:group ref="verification-code">
                            Verification code:
                        </xforms:group>
                    </td>
                    <td>
                        <xforms:input ref="verification-code" style="width:
3em"/>
                    </td>
                </tr>
            </table>
        </xforms:group>
    </body>    
</html>
========End =====

I would like to know, how to make Orbeon XForm engine to process HTML + XFORM.



Thanks,
Ketan


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: is Html Page with XForm tags processed by Orbeon XForm engine?

Alessandro Vernet
Administrator
Ketan,

On Fri, Oct 9, 2009 at 10:18 AM,  <[hidden email]> wrote:
> I would like to know, how to make Orbeon XForm engine to process HTML + XFORM.

The XForms engine only runs if it finds a
/xhtml:html/xhtml:head/xforms:model (the test is in
xforms-epilogue.xpl). But just changing this might not be enough to
make the XForms engine work on a document in which HTML elements are
in no namespace.

But I am not convinced that this is a good thing to do anyway: there
isn't much of a downside in putting "xhtml:" in front of the elements
name, and if the syntax bothers you, you can always define the XHTML
namespace as the default namespace. The serializer will remove that
namespace when the page is sent to the browser, so the namespace will
only be there in your files, making explicit what element is in what
namespace.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: is Html Page with XForm tags processed by Orbeon XForm engine?

Ketan

Alessandro,

Thanks for your reply. But, I couldn't find xforms-epilogue.xpl in orbeon war
file (Orbeon 3.7.1 developer release). Or Do I need to create one?

Here is what I am trying to achieve.
I am planning to develop a portal application based on workflow engine and
Orbeon forms. I will have 2 portlet apps: one is Orbeon Forms (already
available) and the other is my app. My app will use Orbeon X-Form Engine to
process/submit forms and generate browser content.

In my portlet app, I can not control <head> tag of my portal page. I can
control only what my portlet can render and that's in <body> tag. In this case,
<XForm:model> tag  will be in <body> tag. So, I was trying to find a way to
tell Orbeon XForm Engine to process XForm and generate Html.

Thank you very much.

Ketan


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: is Html Page with XForm tags processed by Orbeon XForm engine?

Erik Bruchez
Administrator
Ketan,

xforms-epilogue.xpl is inside orbeon-resources-private.jar.

-Erik

On Fri, Oct 9, 2009 at 1:05 PM,  <[hidden email]> wrote:

>
> Alessandro,
>
> Thanks for your reply. But, I couldn't find xforms-epilogue.xpl in orbeon war
> file (Orbeon 3.7.1 developer release). Or Do I need to create one?
>
> Here is what I am trying to achieve.
> I am planning to develop a portal application based on workflow engine and
> Orbeon forms. I will have 2 portlet apps: one is Orbeon Forms (already
> available) and the other is my app. My app will use Orbeon X-Form Engine to
> process/submit forms and generate browser content.
>
> In my portlet app, I can not control <head> tag of my portal page. I can
> control only what my portlet can render and that's in <body> tag. In this case,
> <XForm:model> tag  will be in <body> tag. So, I was trying to find a way to
> tell Orbeon XForm Engine to process XForm and generate Html.
>
> Thank you very much.
>
> Ketan
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws