How can mode of form detail page be detected: "edit" or "view"

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

How can mode of form detail page be detected: "edit" or "view"

Lyle Sidor
Is it possible to determine the mode that a form detail page is in from within the form definition file?

It looks like there are three modes:  "new", "edit", and "view".

I have some custom buttons, so I cannot use the oxf.fr.detail.buttons.view.*.* or oxf.fr.detail.buttons.*.* properties to configure the workflow-review and the workflow-edit buttons so they must be included in my form definition like so:

<fr:buttons>
    <fr:button [custom button definition]
    </fr:button>
    <fr:save-locally-button/>
    <fr:workflow-edit-button/>
    <fr:workflow-review-button/>
    <fr:pdf-button/>
    <fr:close-button/>
</fr:buttons>

However, they both show up in all modes: "new", "edit", and "view" and so one or the other is always redundant clutter.

I would like to conditionally display only the necessary buttons depending on what mode the form is in, so I first need to be able to determine what mode the form is in. Can this be done from within the form definition?
Reply | Threaded
Open this post in threaded view
|

Re: How can mode of form detail page be detected: "edit" or "view"

Erik Bruchez
Administrator
Lyle,

There is an XForms variable named $fr-mode which you can test on. I
haven't tried this but it *should* be in scope for the buttons.

-Erik

On Thu, Jun 28, 2012 at 11:59 AM, Lyle Sidor <[hidden email]> wrote:

> Is it possible to determine the mode that a form detail page is in from
> within the form definition file?
>
> It looks like there are three modes:  "new", "edit", and "view".
>
> I have some custom buttons, so I cannot use the
> oxf.fr.detail.buttons.view.*.* or oxf.fr.detail.buttons.*.* properties to
> configure the workflow-review and the workflow-edit buttons so they must be
> included in my form definition like so:
>
> <fr:buttons>
>    <fr:button [custom button definition]
>    </fr:button>
>    <fr:save-locally-button/>
>    <fr:workflow-edit-button/>
>    <fr:workflow-review-button/>
>    <fr:pdf-button/>
>    <fr:close-button/>
> </fr:buttons>
>
> However, they both show up in all modes: "new", "edit", and "view" and so
> one or the other is always redundant clutter.
>
> I would like to conditionally display only the necessary buttons depending
> on what mode the form is in, so I first need to be able to determine what
> mode the form is in. Can this be done from within the form definition?
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/How-can-mode-of-form-detail-page-be-detected-edit-or-view-tp4655384.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
>


--
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