简体   繁体   English

如何根据用户在Drupal 7中放入Webform的条件显示预告片(字段)?

[英]How to display teasers (fields), dependent of conditions user put into webform in Drupal 7?

I want to make site that displays form, and makes user capable to input certain parameters in it. 我想制作一个显示表单的网站,并使用户能够在其中输入某些参数。 For example, real estate site. 例如,房地产网站。 Let say I have these fields among others: location, price, size. 可以说我有以下几个字段:位置,价格,大小。 If user choose to see houses under 100 000$, Drupal has to back node teasers (fields) for houses only under that price. 如果用户选择查看价格低于10万美元的房屋,则Drupal只能支持该价格以下房屋的节点预告片(区域)。

Now, I wonder how to make Views module start searching when user click submit button, and how to make conditions under which Views search, dynamically dependent of parameters users put into form. 现在,我想知道如何在用户单击“提交”按钮时使Views模块开始搜索,以及如何使Views搜索条件动态地取决于用户放入表单中的参数。

Do I need some additional modules beside Views and Webform modules? 除了“视图”和“ Webform”模块外,是否还需要其他一些模块? Or maybe, I don't need them? 或者,也许我不需要它们? Maybe I have to write some php/mysql script that do searching and fetching, but, naturally, I think Views module is build for that kind of circumstances. 也许我必须写一些用于搜索和获取的php / mysql脚本,但是自然地,我认为Views模块是为这种情况而构建的。 Thanks in advance! 提前致谢!

1) There is an option in Views when you create the exposed filters: " Remember the last selection ". 1)创建公开的过滤器时,“视图”中有一个选项:“ 记住最后一个选择 ”。 This caches the user selection for each Views and when user visits the Views again he will see the previous filters enabled. 这将缓存每个视图的用户选择,当用户再次访问视图时,他将看到先前的过滤器已启用。

2) For better UX you can use Better_Exposed_Filters and Views_Saved_Searches modules. 2)为获得更好的用户体验,可以使用Better_Exposed_FiltersViews_Saved_Searches模块。 With the first one you have much more options for exposed filters (eg expose as checkboxes) and with the last one users can save their searches and use them later (like bookmarking a url path). 对于第一个,您可以使用更多的公开过滤器选项(例如,以复选框形式公开),而对于最后一个,用户可以保存搜索并稍后使用(例如,为URL路径添加书签)。

PS. PS。 I don't think using the Webform module with views will be useful in order to create personal saved searches. 我认为将Webform模块与视图一起使用不会对创建个人保存的搜索有用。 Instead, Views Saved Searches is what you are looking for. 相反,您需要的是“查看保存的搜索”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM