This project is read-only.

Hiding a numeric field

Topics: Customizing Orchard, Writing modules
Sep 5, 2013 at 11:19 AM
I am creating a module which has a part and some fields on that part. One field is for certain meta data and I want to hide that field on the front-end and the back-end. The value of this field will be automatically filled, the user should not be able to see or edit the contents of that field.

So I used shape tracing to see what I need to add to my file to hide the field. This is my file:
    <Place Fields_Numeric-FieldName="-"/>
    <Place Fields_Numeric_Edit-FieldName="-"/>
I also tried it withouot the "-FieldName" part, but that doesn't work either. I was thinking that I maybe have to do something like this:
    <Place Parts_PartName_Fields_Numeric-FieldName="-"/>
    <Place Parts_PartName_Fields_Numeric_Edit-FieldName="-"/>
But that also doesn't work. What am I doing wrong?
Sep 5, 2013 at 11:42 AM
Edited Sep 5, 2013 at 11:42 AM
Try adding the placement stuff to your theme
Sep 5, 2013 at 12:15 PM
Yes, that works, thanks. This is not optimal however, is it not possible to do this in a module?
Sep 5, 2013 at 12:54 PM
Well basically the Orchard.Fields module is overwriting your placements in your module. So you can give your module a higher priority to fix this. In your module.txt add Priority: 10 to the bottom. You can give different features different priorities.
Sep 5, 2013 at 1:33 PM
I did not know that I can add priorities for an entire module. It works now, thanks a lot :)
Sep 5, 2013 at 2:01 PM
Yeah, Orchard is full of awesome features that are not talked about enough. And you are most welcome
Sep 18, 2013 at 4:43 PM
Edited Sep 19, 2013 at 8:16 AM
Hmm, when I hide my field and then try to read the value, it is always null. When the field is visible, it always works fine. This is what I use:
Is this a feature, or a bug, or am I doing something wrong?
Sep 19, 2013 at 3:38 PM
Hmm, I'm not sure. Would need an Orchard junkie to throw in his two cents.

But are you accessing the value from your view? I use this:
This hasn't failed me.
Sep 20, 2013 at 8:20 AM
No, I'm accessing the value in a workflow activity. The only way I know of to get the value is by using Storage.Get().