开发者

Use a link as a form field without javascript

i'm almost done developing a search engine in django 1.3. I'm having some filters on the left side of my application.

What i want to do is displa开发者_如何学运维y those filters as links (not as radiobuttons /selectbox /checkbox) and whenever a user clicks on one of those links, the form is resubmitted with that filter's value submitted (maybe grabbed by a TextInput widget)

Basically, something like the left side filtering in this example from Google, but without javascript (so even a "non js user" can use my website)

Is it possible? How? Or am i bound to javascripts for this purpose?

Thanks all in advance!


Why not simply use GET query parameters?

Imagine the following:

  • User searches for "bear", the URL becomes: /search/?q=bear
  • The query parameters are handled by your view (collect all images corresponding to the query parameters)
  • The query parameters are sent back to the template in a variable;
  • Each filter link has the query parameters attached to it together with its own specific parameters, so that the filter link for e.g. medium-sized images becomes /search/?q=bear&size=medium;
  • Upon clicking that filter link, your view will get a q and an size key in its request.GET dictionary;
  • Repeat ad infinitum (e.g. /search/?q=bear&size=medium&expression=smiling&color=b-w&activity=dancing).
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜