Skip to content

Tag: dynamic

How to dynamically change Django Form field type (e.g. `forms.CharField` to `forms.ChoiceField`) without changing the data member variable?

TL;DR How can I change the search term CharField (of any of the rows in the image below) to another field type (e.g. ChoiceField, DateField, etc) based on the type of the selected database field (in the first select list on that row – see screenshot below)? Long version I have a cool hierarchical advanced search interface, e.g.: Each row

Is it possible to dynamically change the color of a dropdown or change list item color when a radio option is selected in Javascript/JQuery?

I have code that allows me to select a radio option, say, ‘Work’, and have the dropdown box automatically select ‘Work’ in response. But is it possible to go further and to select the radio option ‘Work’, and have the ‘Work’ dropdown be selected and also change to blue, for instance. And green for ‘Grocery’, red for ‘Chores’, etc. Maybe