Posted: Thu Nov 16, 2006 12:25 pm
While there are ways to hide a field both from the edit tab (widget:type = hidden) and from the list (visibility:list = hidden), currently there is no method in Dataface to hide a field from View Tab. These instructions will help you do just that.
First you need to copy the file /path.to.dataface/Dataface/templates/Dataface_View_Record.html to path.to.your.dataface.app/templates folder. Then edit the file that is in your app/templates directory (not the original Dataface template). Look for the following lines:
{$field.widget.label}:
{$record->htmlValue($field.name)}
At about lines 60 and 61. Change them to the following:
{$field.widget.label}:
{$record->htmlValue($field.name)}
The reason we are using id="{field.name} in both instances is so that your CSS ID will be the same. If use used $field.widget.label, you would have spaces in some IDs, which is not allowable within CSS. Whereas field names cannot have spaces, so you are already good there.
Next, you need to include a line in /path.to.dataface/plone.css to import a custom css style sheet. I do this:
@import url(/styles/custom.css);
You can put it anywhere, I usually just put it at the top of my plone.css after the original author's comments. Now I use /styles/custom.css because I have some unix soft links going on in my system, so that way I can have one copy of Dataface feed all of my apps and websites. However your setup might be different. Just use whatever path is most correct for your setup. And remember that is the path as the browser would see it, not the file system path.
Next create a custom.css and place within it the following lines:
/* Stops FIELDNAME from being displayed since it shows up on view anyhow. */
#fieldname-label,
#fieldname-value
{
display: none;
}
Note that it does appear from my experients that these fields ARE case sensitive. Replace fieldname with the name of your field. You can copy this code multiple times, but make sure that all of the #fieldname-whatevers have a comma after them except the very last one (the one right before the {display: none;}.
Thats its, hope someone finds this useful.
Thank you kindly.
First you need to copy the file /path.to.dataface/Dataface/templates/Dataface_View_Record.html to path.to.your.dataface.app/templates folder. Then edit the file that is in your app/templates directory (not the original Dataface template). Look for the following lines:
At about lines 60 and 61. Change them to the following:
The reason we are using id="{field.name} in both instances is so that your CSS ID will be the same. If use used $field.widget.label, you would have spaces in some IDs, which is not allowable within CSS. Whereas field names cannot have spaces, so you are already good there.
Next, you need to include a line in /path.to.dataface/plone.css to import a custom css style sheet. I do this:
@import url(/styles/custom.css);
You can put it anywhere, I usually just put it at the top of my plone.css after the original author's comments. Now I use /styles/custom.css because I have some unix soft links going on in my system, so that way I can have one copy of Dataface feed all of my apps and websites. However your setup might be different. Just use whatever path is most correct for your setup. And remember that is the path as the browser would see it, not the file system path.
Next create a custom.css and place within it the following lines:
/* Stops FIELDNAME from being displayed since it shows up on view anyhow. */
#fieldname-label,
#fieldname-value
{
display: none;
}
Note that it does appear from my experients that these fields ARE case sensitive. Replace fieldname with the name of your field. You can copy this code multiple times, but make sure that all of the #fieldname-whatevers have a comma after them except the very last one (the one right before the {display: none;}.
Thats its, hope someone finds this useful.
Thank you kindly.