Share » Forums » Setup & design » Customising forms

Customising forms

Customising forms

Monday 12 January 2004 5:31:14 am - 3 replies

Author Message

Tore Skobba

Monday 12 January 2004 7:17:37 am

Hi

I had a somewhat similar problem, users should enter their data. However, only SOME of this data should be available for viewing by all users. As such I had this template code:

<ul class="attribute_list">
{section name=ContentObjectAttribute loop=$node.contentobject_version_object.contentobject_attributes}
{section show=$:item.contentclass_attribute.name|begins_with("Restricted")|not()}
<li> {$ContentObjectAttribute:item.contentclass_attribute.name|wash}:
{attribute_view_gui attribute=$ContentObjectAttribute:item}</li>
{/section}
{/section}
{/let}

Here ALL attributes begning with "Restricted" are not shown, you could the same in your edit template, simply allow editing of all attributes which does not begin with "Restricted" or whatever. For more see here:

http://www.ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/hiding_attribute_content

James Packham

Monday 12 January 2004 1:58:07 pm

I don't fully understand - how do I add this to the exisiting edit_attribute.tpl? I tried

{section show=and(eq($ContentObjectAttribute:item.contentclass_attribute.can_translate,0),
ne($object.default_language,$ContentObjectAttribute:item.language_code)) |begins_with("Restricted")|not()) }

and

{section show=and(eq($ContentObjectAttribute:item.contentclass_attribute.can_translate,0),
ne($object.default_language,$ContentObjectAttribute:item.language_code),
ne($:item.contentclass_attribute.name|begins_with("Restricted")|not()) ) }

Among others, with and without the ; But none of them worked. Where do I need to put your wizzy bit of code?

Thanks,

~James~

James Packham

Wednesday 14 January 2004 1:55:26 am

Yay! I figured out how to do it. Incase anyone's interested you can add the following section statement to an override of edit_attribute.tpl (the code in the middle is already in edit_attribute). This uses the name of the attribute to filter out the attributes you don't want.

All you have to do then is add the word restricted to the begining of the identifier for the attributes you don't want.

{section show=$ContentObjectAttribute:item.contentclass_attribute_identifier|begins_with("restricted" )|not()}
<label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label><div class="labelbreak"></div>
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
{attribute_edit_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}

{/section}

Also bear in mind that this code is repeated in a section-else (though I'm not sure why, something to do with a different set of conditions).

Thanks for your help :)

~James~

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu