For a field (RO), not available in EditView
I would like create a particular field type with this logic:
- The field is a Dropdown list
- In ListView, we would like show a coloured circle: the color is based on the value of the dropdown value
- In DetailView, we would like show the coloured circle like in listview and the dropdown value.
Has anyone had the same need?
thank you @pgr,
Yes, I think that change a little bit this instruction
$bean->industry = "<div style='border: solid 5px #$colour;'>".$bean->industry."</div>";
I can reach my goal in ListView.
Can I made the same hook in DetailView?
You can accomplish that setting up a customCode. Take a look at any detailvew.php, you will find some customCode samples.
I tried this example (in listview) and it works. In my case, I have a multiselect field, but with this example I can’t show the colored circle
Is there the possibility to do the same operation but with multiselect?
Thank you so much,
Does your hook take effect?
Perhaps it changes the HTML (you can see it rendered in the browser’s Dev console) but it’s not taking effect because there is other HTML around it? Something specific to Multiselects?
My hook works if I put my coloured circle, for example, near the name (that is a string). If I put in my multiselect field, it doesn’t work.
I try to print the vaule of my field before and after my changes and the value is similar than:
where Val1 and Val2 are the selected values of multiselect field.
So I think that after there is a manipulation of the value to show in the correct way.
How does it look in the rendered HTML (browser developer console)?
Do you mean how it look after hook or normally, without customization?
Well, both would be useful actually, to compare. But I bet that you can solve this yourself after looking at that.
You might need to have a look at the directory
include/SugarFields to see the files related to that field type.