Condition check with Services & Actions

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

Condition check with Services & Actions

karthik Jayaraman
Hi All,

I am using Services & Actions to pre-populate data in my Orbeon form.

I am using "Form Load" event to load data in the Orbeon form in turn calling an database service.
Since I am using "Form Load" each time I access the form the service is called, instead I want to call the service only for the first I am accessing the form.  Is there any event available in Orbeon to achieve this.

Kindly give me some information regarding this issue.

Reply | Threaded
Open this post in threaded view
|

Re: Condition check with Services & Actions

karthik Jayaraman

Hi,

I have tried with Activation event available, by using that I can have a button and on click of that button the action will be invoked.  I need to execute the action only on first time page load and thereafter it should not.  Kindly someone help me in this issue.


Thanks & Regards
Reply | Threaded
Open this post in threaded view
|

Re: Re: Condition check with Services & Actions

Alessandro  Vernet
Administrator
Karthik,

You can do this by creating an action and selecting "Form Load" in the
"React to" drop-down (see attached screenshot).

Alex

On Sun, May 2, 2010 at 9:24 PM, karthik Jayraman <[hidden email]> wrote:

>
>
> Hi,
>
> I have tried with Activation event available, by using that I can have a
> button and on click of that button the action will be invoked.  I need to
> execute the action only on first time page load and thereafter it should
> not.  Kindly someone help me in this issue.
>
>
> Thanks & Regards
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Condition-check-with-Services-Actions-tp2075066p2123493.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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

form-load.png (88K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Condition check with Services & Actions

karthik Jayaraman


Alex,

I have designed my form using "Form Load" event only as you have mentioned in your screenshot and it works fine.  My issue is, whenever I load the form the "Form Load" event is called and the form gets prepopulated instead I want to make it happen only during the first time the page loads.

Scenario:
I have two buttons, "Save as Draft" and "Submit."  Save as Draft is used to save the form without triggering any mandatory validation.  Submit to submit the form once submitted cant reaccess the form.

While first time loading the form I am using "Form Load" event to prepopulate some fields available in my form.  The user is changing some values of the prepopulated fields and saving using "Save as Draft."  Now, user closes the browser and loads the form.  Now, the form has to show the prepopulated fields with whatever changes made by the user instead "Form Load" event triggers and once again prepopulates the values in those fields.  How to overcome this.

Kindly provide me some solution.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Condition check with Services & Actions

Alessandro  Vernet
Administrator
Karthik,

I see.  At this point you'll have to edit the source to do this.
Imagine your action is called "on-form-load", go to Edit Source, and
search for "on-form-load". You'll find a  <xforms:action
id="on-form-load-binding">. Inside, there is a <xforms:action
ev:event="xforms-ready" ev:observer="fr-form-model">. Add an "if"
attribute on this element, so it looks like:

<xforms:action ev:event="xforms-ready" ev:observer="fr-form-model"
    if="instance('fr-form-instance')/user/first-name = ''">

The above change will only run the action if the user/first-name is
empty. I imagine you'll have a field like this in your form, which is
guaranteed to have non-empty value when the form is editing vs. loaded
the first time. In this case "user" is the id a section, and
"first-name" the id of a field. We are planning to enhance the action
editor so you can do this type of things through the UI, but in the
meantime, you can always do this by changing the code.

Alex

On Tue, May 4, 2010 at 10:47 PM, karthik Jayraman <[hidden email]> wrote:

>
>
>
> Alex,
>
> I have designed my form using "Form Load" event only as you have mentioned
> in your screenshot and it works fine.  My issue is, whenever I load the form
> the "Form Load" event is called and the form gets prepopulated instead I
> want to make it happen only during the first time the page loads.
>
> Scenario:
> I have two buttons, "Save as Draft" and "Submit."  Save as Draft is used to
> save the form without triggering any mandatory validation.  Submit to submit
> the form once submitted cant reaccess the form.
>
> While first time loading the form I am using "Form Load" event to
> prepopulate some fields available in my form.  The user is changing some
> values of the prepopulated fields and saving using "Save as Draft."  Now,
> user closes the browser and loads the form.  Now, the form has to show the
> prepopulated fields with whatever changes made by the user instead "Form
> Load" event triggers and once again prepopulates the values in those fields.
> How to overcome this.
>
> Kindly provide me some solution.
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Condition-check-with-Services-Actions-tp2075066p2130466.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Condition check with Services & Actions

karthik Jayaraman

Alex,

I appreciate your support.
Thanks a lot ...Your solution works fine for me.

Thanks & Regards
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Condition check with Services & Actions

Alessandro  Vernet
Administrator
Karthik,

Good; thank you for confirming this if="..." condition works for you.

Alex

On Wed, May 5, 2010 at 10:20 PM, karthik Jayraman <[hidden email]> wrote:

>
>
> Alex,
>
> I appreciate your support.
> Thanks a lot ...Your solution works fine for me.
>
> Thanks & Regards
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Condition-check-with-Services-Actions-tp2075066p2132078.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet