Quantcast

Missing mandatory field elements

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

Missing mandatory field elements

benjamin.dougherty
This post was updated on .
What is best practice when your model instance does not include some elements which have bindings to mandatory form elements.

Obviously you can just insert the missing elements but I only really want that to happen when a user edits the bound field.

I can create a shadow template instance with elements for all control fields and bind them to the original instance but that will suffer from the same issue if the element does not exist.

Thanks for help,
Ben.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing mandatory field elements

Erik Bruchez
Administrator
Ben,

I am not sure I understand. Could you please provide an example?

-Erik

On Tue, Mar 13, 2012 at 8:17 AM, benjamin.dougherty
<[hidden email]> wrote:

> What is best practice when your model instance does not include some elements
> which have bindings to mandatory form elements.
>
> Thanks for help,
> Ben.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Missing-mandatory-field-elements-tp4469324p4469324.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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing mandatory field elements

benjamin.dougherty
Sorry Erik I'll try and explain better:

Given:

<xforms:input ref="instance('some-inst')/somecontent" />

When we get this model content the input shows ok:

<instance id="some-inst">
<form>
    <somecontent>hello</somecontent>
</form>
</instance>

But with this:

<instance id="some-inst">
<form />
</instance>

we don't get an input control because the binding fails. Is there any way to tell the control to display even when the binding fails if not what is the best approach to handle mandatory controls binding to non-mandatory model elements?

Thanks in advance,
Ben

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: Missing mandatory field elements

Erik Bruchez
Administrator
Ben,

It's a common situation, yet one that doesn't have a great solution at
this point. The XForms working group has discussed it a few times
already.

One way would be to show a button if the control doesn't have a
binding, or to just automatically insert the missing element based on
the @ref attribute. An insert action adds the missing element.

This could be packaged in an XBL component for reuse. It's by no means
something final but I gave this a shot here:

https://gist.github.com/2156397

You would use it like this:

<fr:optional-element ref="foo">
    <xforms:input ref=".">
        <xforms:label>Foo</xforms:label>
    </xforms:input>
</fr:optional-element>

Maybe something like this would be better:

<fr:optional-input ref="foo">
    <xforms:label>Foo</xforms:label>
</fr:optional-input>

-Erik

On Wed, Mar 21, 2012 at 11:12 AM, benjamin.dougherty
<[hidden email]> wrote:

> Sorry Erik I'll try and explain better:
>
> Given:
>
> <xforms:input ref="instance('some-inst')/somecontent" />
>
> When we get this model content the input shows ok:
>
> <instance id="some-inst">
> <form>
>    <somecontent>hello</somecontent>
> </form>
> </instance>
>
> But with this:
>
> <instance id="some-inst">
> <form />
> </instance>
>
> we don't get an input control because the binding fails. Is there any way to
> tell the control to display even when the binding fails if not what is the
> best approach to handle mandatory controls binding to non-mandatory model
> elements?
>
> Thanks in advance,
> Ben
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Missing-mandatory-field-elements-tp4469324p4493214.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
Loading...