XFormsNG, replace="instance", forward/redirect

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

XFormsNG, replace="instance", forward/redirect

ampatspell
Hello,
Is there a way of making page forward/redirect in submission xpl while it's
called by <submission/> in XForms with replace="instance"?

best,
Arnis




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XFormsNG, replace="instance", forward/redirect

Erik Bruchez
Administrator
ampatspell. wrote:

> Is there a way of making page forward/redirect in submission xpl while
> it's called by <submission/> in XForms with replace="instance"?

The fundamental idea of replace="instance" is that the page will not
reload. So unless I misunderstood the question, no, this is not
possible. You have to use replace="all" to navigate to another page,
i.e. to send another page to the XForms engine.

-Erik



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XFormsNG, replace="instance", forward/redirect

ampatspell
Hello

i was looking for a solution with server side validation (just a simple
login form and success page).
the problems i encoured when, in submission, i had:
1) replace="instance"
    no possibility to show "login success" page or case (the bind with
constraint="result/status = 'success' doesn't work for me)

2) replace="all"
    can't hold empty instance in xhtml head because it cleans up the
instance comming from page-flow. need to copy document('input:instance')
into instance and this complicates development as there's need to create
empty instance in page-flow or xpl.

i'm shure, i'm doing everything wrong. it's just my yesterdays results. is
those problems only for me?

can anyone please provide some example when there's form, submission, and
result what makes showing another page (case) or just shows the initial page
(with the same data as user entered) in case of server side error - `login
already taken`, `id dublicate` or whatever else? it would be really helpfull
for me



btw, in some circumstances when <action action=".."/> is fired in page-flow,
in the web browser i saw:
<result>
    <status>success</status>
</result>
<html ..
...
</html>

i'll try to reproduce it in simplest case possible.


best,
Arnis

p.s. sorry if i sound sceptical. i really like the new features of OPS,
XForms events etc.. now just i'm trying to gasp the new.

----- Original Message -----
From: "Erik Bruchez" <[hidden email]>
To: <[hidden email]>
Sent: Friday, August 05, 2005 9:46 PM
Subject: Re: [ops-users] XFormsNG, replace="instance", forward/redirect


> ampatspell. wrote:
>
>> Is there a way of making page forward/redirect in submission xpl while
>> it's called by <submission/> in XForms with replace="instance"?
>
> The fundamental idea of replace="instance" is that the page will not
> reload. So unless I misunderstood the question, no, this is not
> possible. You have to use replace="all" to navigate to another page,
> i.e. to send another page to the XForms engine.
>
> -Erik
>
>

--------------------------------------------------------------------------------


>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XFormsNG, replace="instance", forward/redirect

Alessandro  Vernet
Administrator
--- "ampatspell." <[hidden email]> wrote:
> i was looking for a solution with server side validation (just a simple
> login form and success page).
> the problems i encoured when, in submission, i had:
> 1) replace="instance"
>     no possibility to show "login success" page or case (the bind with
> constraint="result/status = 'success' doesn't work for me)

Hi Arnis,

From what I understand you want to check some user input and go to another
page if the data entered by the user is valid. Here is a pattern that
works when you want to run some action when a condition is met:

1) Add an instance to your XForms model that you use just for this testing
business. In this case we are doing just one test, so we'll have just a
root element:

    <xforms:instance id="testing">
        <testing>0</testing>
    </xforms:instance>

2) When the user clicks on the "login/check" button, in this example I
assume you do a submission and the results comes back in an instance with
id="valid" which is either <valid>true</valid> or <valid>false</valid>. We
would like to test on this and go to another page if the response is
<valid>true</valid>. Let's start by setting the value of <testing> to 1
when we get <valid>true</valid>:

    <xforms:trigger>
        <xforms:label>Check</xforms:label>
        <xforms:action  ev:event="DOMActivate">
            <xforms:send submission="validate"/>
            <xforms:setvalue ref="instance('testing')"
                value="if (instance('valid') = 'true') then 1 else 0"/>
        </xforms:action>
    </xforms:trigger>

3) This will send an xforms-value-changed event to any control bound to
<testing>. Let's add one, hide it with CSS, and go to another page when we
receive the xforms-value-changed:

    <xforms:input ref="instance('testing')" style="display: none">
        <xforms:send ev:event="xforms-value-changed"
submission="orbeon-com"/>
    </xforms:input>

I have attached the two files you need to run this example. Put them at
the root of our examples directory (along the page-flow.xml), add the 2
lines below to the page-flow.xml, and go to /check-submit with your
browser.

    <page path-info="/check-submit" view="check-submit.xhtml"/>
    <page path-info="/validate" view="validate.xpl"/>

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/

--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

check-submit.xhtml (4K) Download Attachment
validate.xpl (2K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet