处理 html 中依赖选择元素中选项的显示

发布于 2024-09-25 15:59:52 字数 275 浏览 0 评论 0原文

首先,我很抱歉,我似乎无法很好地表达我的问题。

设置:我正在使用 Drupal 来构建这个基于位置的应用程序。

我有一个表格允许用户选择他/她的位置。该表格有 3 个“相关”选择元素,例如国家、城市、州。它们以这样的方式依赖,即选择特定的州[在州选择中]将过滤在城市选择中显示的选项,依此类推。

我正在尝试使用 Jquery 来做到这一点,但我似乎无法使其工作。

我知道我的问题对于此类事情的专家来说非常微不足道,但我不是,因此我请求您的帮助。

非常感谢!

Firstly, I am sorry, i just can't seem to phrase my question well.

Setup: I am using Drupal to build this location-based application.

i have a form which allows the user to select his/her location. the form has 3 'dependent' select elements e.g. country, city, state. they are dependent in such a way, that selecting a particular state [in the state select] will filter the choices which get displayed in city select, and so on.

I am trying to do this using Jquery, but i can't seem to make it work.

I know that my issue is very trivial for you out there expert in this kind of thing, but I'm not, therefore I am asking for your assistance.

Thank you very much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟沫凡尘 2024-10-02 15:59:52

根据您上面的评论,我建议您研究 Drupal 的 AHAH 组件,这些组件在 http://drupal 中有详细描述.org/node/348475。您所描述的情况正是 AHAH 的构建目的,它将省去您在 Javascript 中乱搞来管理 Drupal 逻辑的麻烦。

也就是说,如果您不愿意返回并使用 AHAH 重新执行您的应用程序,则 drupal_json() 函数应该解决您在评论中描述的问题。 drupal_json 基本上表示“返回 json 对象而不是 drupal 页面”。

Based on your comment above, I'd recommend looking into Drupal's AHAH components, which are described in detail at http://drupal.org/node/348475. The situation you're describing is precisely what AHAH was built for, and it will save you the trouble of mucking around in Javascript to manage Drupal logic.

That said, if you're not willing to go back and re-do your application using AHAH, the drupal_json() function should address the problem you described in your comment. drupal_json basically says "return a json object instead of a drupal page".

寂寞陪衬 2024-10-02 15:59:52

当您可以使用 Drupal 中的模块来构建依赖的选择元素时,为什么还要使用 jQuery?

查看http://drupal.org/project/hierarchical_select

Why use jQuery when you can use a module in Drupal that allows you build dependent select elements?

Check out http://drupal.org/project/hierarchical_select

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文