WebexPythonSDK icon indicating copy to clipboard operation
WebexPythonSDK copied to clipboard

Cards - Choices

Open knorton3 opened this issue 4 years ago • 2 comments

Good evening,

Can you please provide an example of how to use the Choices input for adaptive cards? I am receiving the following error when I try to pass a list.

item.to_dict() for item in property_value AttributeError: 'str' object has no attribute 'to_dict'

Thanks, Ken

knorton3 avatar Dec 21 '21 03:12 knorton3

Modified the inputs.py with the following and it worked:

super().init( serializable_properties=[], simple_properties=[ 'id', 'type', 'isMultiSelect', 'style', 'value', 'height', 'separator', 'spacing','choices' ], )

example list to pass it

choice_list = [{'title':'customer1', 'value':'customer1'},{'title':'customer2', 'value':'customer2'}]

mychoice = Choices(choice_list, id='customer')

knorton3 avatar Dec 21 '21 18:12 knorton3

This is still an issue, and I don't like to have to modify a 3rd party library unless necessary, this method works without the need to modify the WebexPythonSDK. This will modify the attributes of your instance rather than the library. Keep in mind that if you upgrade the library, your modifications may be overwritten. However, this is a quick fix until the issue is resolved and.

choices = [{"title":  "foo", "value": "1"}, {"title": "bar", "value": "2"},]
report.serializable_properties = []
report.simple_properties.append("choices")

barweiss45 avatar Feb 07 '24 07:02 barweiss45