如何在ASP中同步两个列表/菜单表单域 [英] How to synchronize two list/menu form fields in ASP

查看:64
本文介绍了如何在ASP中同步两个列表/菜单表单域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,


我使用Dreamweaver CS3设计包含记录插入表单的ASP页面。在此表单中有两个列表/菜单表单字段,我想同步。换句话说,假设我有两个菜单:一个用户选择日历季度的菜单。和第二个用于选择日历月。如果用户选择Q1,则用户可以选择Q1。从第一个菜单开始,然后重新获取第二个菜单并刷新第二个菜单。仅显示月份Jan.,Feb。和Mar.


我知道如何使用VisualBasic为MS Access表单执行此操作,但我不知道如何为ASP完成此操作。


任何建议或建议都是最受欢迎的。


- JM

Greetings,

I am using Dreamweaver CS3 to design an ASP page that contains a Record Insertion Form. Within this form are two list/menu form fields that I would like to "synchronize". In other words, let''s say I have two menus: one where the user selects "Calendar Quarter" and a second for selecting "Calendar Month". If the user selects "Q1" from the first menu, then the second menu is requeried and "refreshed" to show only the months "Jan.", "Feb". and "Mar."

I know how to do this using VisualBasic for MS Access forms but am not sure how to accomplish this for ASP.

Any advice or suggestions would be most welcome.

- JM

推荐答案

问题是ASP是严格来说,它是一种服务器端技术,只要页面加载到浏览器上就会停止工作。为此,您至少需要一些客户端脚本。有两种方法我经常看到这样做,都涉及一些JavaScript,你的选择在很大程度上取决于你想要使用多少JavaScript。以下是选项:


1 - 当您进行第一次选择时,使用一个非常简短的函数来提交表单,因为它到目前为止(不是很多javascript,对吧?其余的都完成了在ASP)。表单处理程序(最好是这个相同的ASP页面)应该重新填充表单并将其发送回用户(希望足够快,以至于他没有意识到他已经提交了任何内容),并且已输入的输入已填写完毕并且有问题的选择更改为可用的月份。


2 - 制作第二个选择的多个版本,并且所有这些版本都应隐藏。在第一个下拉列表的onChange事件中,取消隐藏第二个下拉列表的相应版本并重新隐藏所有其他版本。


我看到这两种方法都使用得很好在实时网站上。让我知道这是否有帮助。


Jared
The problem is that ASP is strictly a server-side technology, it ceases to work as soon as the page is loaded onto the browser. For that you will need at least some client-side scripting. There are two ways I often see this done, both involve some javascript and your choice depends largely on how much javascript you want to use. Here are the options:

1 - when you make the first selection use a very brief function to submit the form as it is so far (not much javascript, right? the rest is done in ASP). The form handler (preferably this same ASP page) should re-populate the form and send it right back to the user (hopefully fast enough that he doesn''t realize he has submitted anything) with the inputs he has already entered filled out and the select in question changed to the months available.

2 - Make several versions of the second select, and all of them should be hidden. On the onChange event of the first drop-down, unhide the appropriate version of the second drop-down and rehide all the others.

I''ve seen both of these methods used well on live web sites. Let me know if this helps.

Jared



问候,


我使用Dreamweaver CS3设计包含记录插入表单的ASP页面。在此表单中有两个列表/菜单表单字段,我想同步。换句话说,假设我有两个菜单:一个用户选择日历季度的菜单。和第二个用于选择日历月。如果用户选择Q1,则用户可以选择Q1。从第一个菜单开始,然后重新获取第二个菜单并刷新第二个菜单。仅显示月份Jan.,Feb。和Mar.


我知道如何使用VisualBasic为MS Access表单执行此操作,但我不知道如何为ASP完成此操作。


任何建议或建议都是最受欢迎的。


- JM
Greetings,

I am using Dreamweaver CS3 to design an ASP page that contains a Record Insertion Form. Within this form are two list/menu form fields that I would like to "synchronize". In other words, let''s say I have two menus: one where the user selects "Calendar Quarter" and a second for selecting "Calendar Month". If the user selects "Q1" from the first menu, then the second menu is requeried and "refreshed" to show only the months "Jan.", "Feb". and "Mar."

I know how to do this using VisualBasic for MS Access forms but am not sure how to accomplish this for ASP.

Any advice or suggestions would be most welcome.

- JM



您使用的是经典ASP吗? (Response.write变量)


或者您使用的是ASP.NET吗? (web控件,例如< asp:Datagrid>等等)

如果您使用的是asp.net,您所描述的内容可以间接完成,因为.net页面不会重新加载整个页面但只能来回发送数据。


那里可能有asp.net calander控件,或者为Dreamweaver添加。


如果你实际上使用的是经典的ASP,但是jh说的是正确的,你将需要使用javascript来实现类似于在使用界面的用户面前发生的事情,而无需重新加载整个页面,或打开新窗口等。

Are you using classic ASP ? (Response.write Variable)

Or are you using ASP.NET? (web controls such as <asp: Datagrid> , etc

If you are using asp.net what you describe can be accomplished, indirectly since .net pages do not reload the entire page but only send data back and forth.

There are probably asp.net calander controls out there, or add ons for dreamweaver.

If you are in fact using classic ASP however what jh said is correct, you will need to use javascript to implement something like that that happens right in front of the user working with the interface, without reloading the entire page, or opening new windows, etc.


我认为你的第二个选择可能是两个中更容易的,因为我的ASP经验有限。你能否指点我看样本代码的方向你已经看过这个?虽然我理解这个概念,但我不确定如何在Dreamweaver CS3或后端编码中实现这一点。


你可能拥有的任何例子都是mo st help。


- JM
I think your second option is probably the easier of the two, given my limited ASP experience. Could you perhaps point me in the direction of sample code where you''ve seen this done? While I understand the concept, I''m not sure how to accomplish this in Dreamweaver CS3 or by back-end coding.

Any examples you may have would be most helpful.

- JM


这篇关于如何在ASP中同步两个列表/菜单表单域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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