根据另一个SelectBox的当前选择更改一个SelectBox的项目 [英] Change items of one SelectBox based on current selection of another SelectBox

查看:128
本文介绍了根据另一个SelectBox的当前选择更改一个SelectBox的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

过程如下:

一个选择框中的选定元素应仅在另一个选择框中弹出与该选定项目相关的元素.
我很难解决这个问题.


任何帮助将不胜感激.


谢谢!

Hi!

The process is as follows:

The selected element in one Selectbox should only popup the associated elements with that selected item in another select box.
I am having a hard time trying to resolve this issue.


Any help would be appreciated.


Thanks!

推荐答案

汗,

我将这样进行:

A1.设置事件处理程序(javascript),用于选择框A的选择发生更改
A2.在该事件处理程序中,使用选择框A的选定项发出AJAX请求(对于jQuery应该是可能的),在该AJAX对象的成功事件处理程序中,将选择框B设置为从服务器接收到的元素.

或这种情况:

B1. JS中的硬代码,其中SelectBox A中的每个元素都将出现在SelectBox B中的元素.这可以通过使用散列来实现.
B2.参见A1
B3.在事件处理程序中,检查当前选择的值并查找SelectBox B的元素数组.用所述元素填充SelectBoxB.


干杯,


曼弗雷德(Manfred)
Hi Khan,

I would proceed like this:

A1. Setup event handler (javascript) for when selection of selectbox A changes
A2. In that event handler make an AJAX request using the selected item of select box A (should be possible with jQuery) and in the success event handler of that AJAX object set selectbox B to the elements you received from the server.

or this scenario:

B1. hard code in JS which elements are to appear in SelectBox B for every element in SelectBox A. This can be achieved by using a hash.
B2. see A1
B3. In event handler check value of current selection and look up array of elements for SelectBox B. Fill SelectBox B with said elements.


Cheers,


Manfred


这篇关于根据另一个SelectBox的当前选择更改一个SelectBox的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆