cancel
Showing results for 
Search instead for 
Did you mean: 

Create refreshable field in edit properties

glaenen
Champ in-the-making
Champ in-the-making
Hello,

In a custom content model I'm creating I added dynamic drop downs (as explained in the article by Jean Barmash).
This all works nicely but I can figure out how to create a dynamic non editable field (no dropdown).
So in the first dropdown I select a company, then I have a second dropdown the select a contact.
Now I would like to create a field (say company address) dependant on the first dropdown,
but because there is only 1 possible value there shouldn't be a dropdown.

Is this possible? I spent 2 days trying but I can't figure it out.

Thanks,

Glenn
4 REPLIES 4

glaenen
Champ in-the-making
Champ in-the-making
Hello,

I've used those 2 post to configure what I have now.
I already have cascading dropdowns that refresh.
But I would like to have a not editable field that refreshes (so no dropdown).

What I can't figure out is how to create a field that a user can't modify but
gets refreshed with a single value from a constraint. And when you click
ok it should save the value.

Regards,

Glenn

pjcaracuel
Champ in-the-making
Champ in-the-making
I think that this requeriments involves two step:

1.- Create a metadata not editable, using tag <protected>true</protected> in the metadata definition.

2.-Try to populate this metadata with a value from a list constraint. . You can do it with your own constraint.
http://wiki.alfresco.com/wiki/Constraints

Regards

PD: Sorry about my last post, I didn´t understand well.

glaenen
Champ in-the-making
Champ in-the-making
This one I didn't try yet. But after a quick test, (adding "<protected>true</protected>" in the content model on a property with dropdown)
It gives the same result as :
   - making the property read-only in the web-client-config-custom.xml
   - changing JAVAX_FACES_INPUT to JAVAX_FACES_OUTPUT by overriding "UIcomponent generate" from org.alfresco.web.bean.generator.IComponentGenerator
   - overriding "UIComponent createComponent" from org.alfresco.web.bean.generator.TextFieldGenerator to use createOutputTextComponent in edit mode.

The field indeed turns grayed out but it doesn't refresh when choosing an other value in the first dropdown.
Causing the constraint on the property to fail when saving the metadata.

After overriding "UIComponent createComponent" to remove " && propDef.isProtected() == false"
The result is what I'm looking for. But on saving the GUI sends back the original value of the property.
Causing the constraint to fail again because it's expecting the new value.

I was also looking in the direction of changing the type of output field in "UIComponent createComponent" which now is
component = context.getApplication().createComponent(UISelectOne.COMPONENT_TYPE);
to something else. But everything I try here fails to.