开发者

Merge multiple checkbox value in one list in a GET url

开发者 https://www.devze.com 2023-04-06 11:25 出处:网络
In our web application (django based, with solr backend) we have some checkboxes with multiple choices allowed. Problem is my url is getting longer (we\'re using GET method)

In our web application (django based, with solr backend) we have some checkboxes with multiple choices allowed. Problem is my url is getting longer (we're using GET method)

Something like

?what=&where=&within=an开发者_如何学运维y&rooms=any&rooms=any&baths=any&baths=any&sqrft=&sqrft=&price=&price=&property-type=any&date=any

is it possible to merge the repeated ones in one list comma separated?

?what=&where=&within=any&rooms=any,any&baths=any,any&sqrft=any,any&price=any,any&type=any&date=any

they are all ranges [min,max] so it would be good (i guess) to keep them grouped togheter.

thanks in advance


Things you can do:

1) Prepare the shorthand querystring using Javascript and then parse it on the server

2) When the user submits a URL with a long querystring, redirect them to a URL with a short querystring

3) Do a combination of 1 and 2. If the user has Javascript enabled, do 1, otherwise do 2

0

精彩评论

暂无评论...
验证码 换一张
取 消