Skip to content Skip to sidebar Skip to footer

Dynamically Build AJAX Dropdown Resets To Original State When Trying To Save With Django Form?

I my form I have few dropdowns chained between them with AJAX. This is how I a populating them function getleaseterm() { //get a reference to the select element

Solution 1:

I have figured out what was the problem it is in my form file

If I keep the lease and leaseterm fields just in Meta class that it doesn't reset those fields on submit any more . And all my logic finally works as designed.

class MassPaymentForm(forms.ModelForm):


    class Meta:
        model = LeasePayment

        fields = ['lease', 'leaseterm', 'payment_type', 'is_deposit',  'amount', 'method', 'payment_date', 'description']

Post a Comment for "Dynamically Build AJAX Dropdown Resets To Original State When Trying To Save With Django Form?"