Writeable readonly fields in a form

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

Writeable readonly fields in a form

bwallis42
This post was updated on .
We have forms that in normal usage make all but the first iteration of a
repeat readonly using something like this

<xforms:bind nodeset="communityProgressNote/noteList/note" 
    readonly="position() != 1" />


This is how the form normally works but there are certain exceptional cases
where a "super user" needs to make a correction to an existing entry.

I could change every template that uses this construct to be something like
this
<xforms:bind nodeset="communityProgressNote/noteList/note"
    readonly="position() != 1 and $fr-roles = 'admin'" />

(I haven't actually tried this, I think it should work) but that requires
every template to be modified/written to allow editing of the readonly
fields. I really want the ability to edit all of them for occasional data
fix operations.

At the moment we have to find the data file in our document repository and
edit it using vi or some such text editor.

Is there a better way to allow this sort of data fixing?

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

Alessandro  Vernet
Administrator
Hi Brian,

It looks like the code in your message has been swallowed somehow. If you
are posting from discuss.orbeon.com, you can check how the forum understands
what you typed by hitting the Preview button. You can also use the "Raw
text" tag to escape your code.

<http://discuss.orbeon.com/file/t119778/Raw_text.png>

Could post a follow-up with your full message, since as it stands now, with
the missing code, I can't really guess what you're asking :).

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

bwallis42
Hi Alex, no idea what happened there, I did use raw for the code.

I've edited the post and added the code back in.

thanks
brian...


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

Alessandro  Vernet
Administrator
Got it Brian, but if the nodes are marked as read-only through an `xf:bind`,
there is no "global" workaround (not changing the form, e.g. through a
property) to make controls bound to those read-only node not read-only. Or
am I misunderstanding your question?

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

bwallis42
Yep, you've got it.

Thanks for the confirmation, I suspected there wouldn't be a global way to
do it. It really wouldn't make sense to do that because some fields in some
forms should never be read write.

Is what I have above the best way to achieve this for a form so we can make
some fields that are readonly for most users editable by a super user?

thanks
brian...


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

Alessandro  Vernet
Administrator
Brian, correct. Except, in the context of Form Runner, I would use the
`fr:user-roles()` function, rather than the internal `$fr-roles`.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

bwallis42
OK. Thanks Alex.

Do you recall if either fr:user-roles() or $fr-roles will work in version
3.9? If so is it configured the same using oxf.fr.authentication.method and
oxf.fr.authentication.container.roles in the properties file?

If not then this is just another reason for our customers on the old version
to upgrade.

thanks, brian...


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Writeable readonly fields in a form

Alessandro  Vernet
Administrator
Brian, I don't think we had `fr:user-roles()` in 3.9. However, I seems we had
`xxf:is-user-in-role('my-role')`; you could try that. Or you can use
`$fr-roles` (which was defined in `fr/components/components.xsl`). Or of
course, as you said, upgrade to a newer version ;).

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet