Hi Team,
I have created one association in datalist content model as per below:
<associations> <association name="classi:picture"> <title>Picture</title> <source> <mandatory>false</mandatory> <many>true</many> </source> <target> <class>cm:content</class> <mandatory>false</mandatory> <many>false</many> </target> </association> </associations>
Document picker is working fine.
I want to allow only png and jpeg files to select.
I have tried the way suggested in https://blog.arvixe.com/add-new-form-validation-handler/
if (field.type == "hidden") { var fileName = field.value; }
I'm getting attached file noderef as an output.
How to get associated file name?
Thanks,
Hardik
You cannot get any more meaningful data from the value in a validation handler within the client-side JavaScript code. You could perform a ReST call to the backend to resolve the value to the node data including mimetype / extension, but ReST calls being asynchronous, that would decouple you from the validation handler flow of execution and you could not influence the result of the validation anymore. There is technically already a parameter that can be used to restrict which elements can be selected in document pickers, and it is even supported by the default client-side picker component, but the default association form control provides no means to specify that option via the control parameters. You would have to create a custom variant of the association control template to pass that along - I have done so in two customer projects and it works quite well.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.