wtforms/wtforms-sqlalchemy

[Question] How can I add data attributes to options?

janpeterka opened this issue · 1 comments

I have form where I set objects label:

    label = QuerySelectField(query_factory=labels)

As I have my own styling of Select field using javascript, I would like to pass value of label.color to my HTML.
My idea is to have <option data-color="mycolor">.
How (if) can I achieve this?

Thank you for your help.

Sorry, I don't have the familiarity with this library anymore to answer this, it's probably fairly complex to affect how the options are rendered.

Please use Stack Overflow for questions about your own code. This tracker is for issues related to the project itself. Be sure to include a minimal, complete, and verifiable example. It will reach a much wider audience that could potentially answer.