forms.ChoiceField -- if not selected

How can I show error in HTML, if ChoiceField do not selected? Similary that has CharField(please fill out this field).

My code here:

 flat_Adress = (
        ("1", "West"), ("2", "East") )
 
 class ForecastField(forms.Form):
       flat_Ad = forms.ChoiceField(label='ragion ', choices=flat_Adress)
       flat_price = forms.CharField(label='subject')
 
 
 
 def index(request):
        if request.method == "GET":
            form_index = ForecastField(request.GET)
 
            if form_index.is_valid():
                adress_f = form_index.cleaned_data['flat_Ad']
                price_f = form_index.cleaned_data['flat_price']
 
                html_index = "MyHome/index.html"
               context = {.... }
               return render(request, html_index, context)
 
 
           else:
               newdf = pd.read_csv(r'...csv')
               json_records = newdf.reset_index().to_json(orient='records')
               data = json.loads(json_records)
 
               html_index = "MyHome/index.html"
               context = {'df_csv': data, 'Index_f': ForecastField(), }
 
               return render(request, html_index, context)

When you submit your form you want to show error if value is not selected, Is this right? Because if so you have to handle POST method and I’m seeing in your index view you are just handling GET method.

When you submit your form you want to show error if value is not selected, Is this right?

Yes, How can I use POST method for this?

I’ve updated your view a little to give you understanding, you have to integrate the logic behind your code

def index(request):
    form = ForecastField()

    if request.method == "POST":
        form = ForecastField(request.POST)
        if form.is_valid():
            adress_f = form.cleaned_data['flat_Ad']
            price_f = form.cleaned_data['flat_price']

            html_index = "MyHome/index.html"
            context = {.... }
            return render(request, html_index, context)
        
        else:
            newdf = pd.read_csv(r'...csv')
            json_records = newdf.reset_index().to_json(orient='records')
            data = json.loads(json_records)
        
            html_index = "MyHome/index.html"
            context = {'df_csv': data, 'Index_f': ForecastField(), }
        
            return render(request, html_index, context)

    return render(request, html_index, context)

Sorry, This is not help me.