I need to send the value of the selected option in a drop down to the views.

My html code is as follows:

> <select name="version" id="version" onchange="location = this.value;">
> <option>Select version to compare with</option>
> {%for ver in version_list%}
> **<option value={{ver}} href="{% url 'process_data' ver %}">{{ver}}</
> option>**
> {% endfor %}
> </select>


The above is giving me the following error:

> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/index/11.5.1.18900-96
> http://127.0.0.1:8000/index/11.5.1.18900-97
> Using the URLconf defined in Piechart_Excel.urls, Django tried these URL 
> patterns, in this order:
> admin/
> index/
> process_data/<str:ver> [name='process_data']
> The current path, index/11.5.1.18900-96, didn't match any of these.


However if I am sending the value as follows i.e. without any drop down:

> <a href="{% url 'process_data' ver1 %}">{{ver}}</a>


everything is working as expected.


My urls.py file content is as follows:


from django.urls import path
> from fusioncharts import views urlpatterns
> urlpatterns = [
> path('index/', views.index, name='index'),
> path('process_data/<str:ver>', views.process_data, name='process_data'),
> ] 

Can anyone say why is it not working in the case of drop down but working 
otherwise? If we have to send any value from the html template using drop 
down, then how to do so?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da72e367-bc90-46cd-8b54-3502d1a126b9o%40googlegroups.com.

Reply via email to