Hide Meta data of Custom Content Type from client side js

cancel
Showing results for 
Search instead for 
Did you mean: 
riya_soni42
Active Member

Hide Meta data of Custom Content Type from client side js

Hi,

I have created custom model and created 5 custom type in that and also add meta data fields in each content type by doing confiuration in share-config-custom.xml,

Now I want to add or remove some meta data fields from selected type which we have selected in Alfresco Advanced Search Screen,
I have referred below link :

Hide default metadata in view properties 

But, I don't want that meta data field is always hidden. So, I can not use <hide-property> tag for that.
So I have to change it from client side js, may be from advsearch.js or form.js contained in path Alfresco/tomcat/webapps/share/components/search and Alfresco/tomcat/webapps/share/components/form respectively.

But I don't know how to change it from client side js.

Please provide me the way to remove the meta data fields without affecting the custom model in share-config-custom.xml.

I am using alfresco-5.2.

Thanks in advance.

3 Replies
afaust
Master

Re: Hide Meta data of Custom Content Type from client side js

Unfortunately the meaning of the question is a bit hard to understand due, especially with some of the double negations that distort the meaning.

Dynamic visibility of form fields in Share forms is not something that is supported by any of the out-of-the-box functionality. You would have to do some intensive customisation for that.

Instead of trying to hide/show fields individually, why not provide a custom set template that renders a collapsible group of fields. That way the user can decide when to show / hide a sub-set of the fields. A custom set is usually quite easy to implement: simply provide a FTL for the HTML markup and add a dependency to the client-side JS for handling the toggle to the form dependencies section.

riya_soni42
Active Member

Re: Hide Meta data of Custom Content Type from client side js

Hi Axel,

Thanks for your reply.

I am going to develop the code which will support multiple selection of Custom Content type in Alfresco Advanced Search Screen, for example if I can select cm:content and cm:folder both the content types together,

So, meta data fields are rendered of both the content types,

for now, let's take an example that one meta data fields named "Author Name" is same in both the content types, I don't want that it rendered twice in form template, if meta data fields or selected content types are conflicted so it must be displayed once. For that I have to put the condition for that and write the code for hide the meta data field.

But I don't understand the code for rendering the form template which is written in advsearch.js.

So do you know, how to do this.?

Highlighted
afaust
Master

Re: Hide Meta data of Custom Content Type from client side js

So let me get this straight: You are going to simply render two forms at once for multiple content types and then hide some fields from all but one of the forms when they are duplicates? How do you intend to submit the data of those (separate) forms in a consistent way for the search data web script to handle? How do you intend to handle the necessary OR-ing of the content types in the query the backend creates?

Basically you would have to rewrite / copy&paste&adapt such a substantial fragment of the existing code that it would be easier just to develop your own advanced search without trying to customise what is already there...