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.
Aoirthoir
 
Posts: 420
Joined: Wed Dec 31, 1969 5:00 pm
Top

Postby shiraz » Sat Jan 20, 2007 11:48 pm

Interesting, older versions of Dataface (up to at least 0.53) would not display fields in the View Tab if widget:type is set to hidden. ie. it applied to both viewing and editing. Ideally both editing and viewing ability should be set in fields.ini rather than using this CSS method.

eg. widget:type can be set to one of: no_edit, no_view, no_edit_no_view


But thanks for this hack. It will serve the purpose!


Cheers,

Shiraz
shiraz
 
Posts: 55
Joined: Wed Dec 31, 1969 5:00 pm

Postby shiraz » Sat Jan 20, 2007 11:52 pm

Oh, hey -- this *has* been done!

See: http://framework.weblite.ca/forum/dataface-users/128
shiraz
 
Posts: 55
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 32 guests

cron

[HOW TO] Prevent fields from appearing on the View Tab

A place for users and developers of the Xataface to discuss and receive support.

Postby Aoirthoir » 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)}{$field.widget.label}:{$record->htmlValue($field.name)}
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved