I've a view, with two forms, i want to check which one will be submit, using 'bookingformbtn' in request.POST
and 'visitorformbtn' in request.POST
but both returns false ?! i've to keep both forms in different tag, and the suggested question doesnt work! please i you know something about that let me know ..
here is my views
def my_views_post(request):
print('bookingformbtn' in request.POST)#returns False
print('visitorformbtn' in request.POST)#returns False
# non of these conditions works !
if request.method == 'POST' and request.is_ajax() and 'visitorformbtn' in request.POST:
#do something
elif request.is_ajax() and request.method == 'POST' and 'bookingformbtn' in request.POST:
#do something else
<form method="POST" class="mt-2" id="add_new_guestform">{% csrf_token %}
<--! form inputs -->
<input type="submit" name="visitorformbtn" value=" "save">
</form>
<form method="POST" class="mt-2" id="post-form-add-booking">{% csrf_token %}
<--! form inputs -->
<input name="bookingformbtn" type="submit" value="save">
</form>
is there something i did wrong please ?! thank you for your advice ..