所有标签的一个提交按钮。如何区分点击次数? [英] One submit button for all tabs. How to differentiate the clicks?

查看:113
本文介绍了所有标签的一个提交按钮。如何区分点击次数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个名为tab 1,tab 2,tab 3的标签视图。每个标签都有自己的文本框。所有标签只有一个提交按钮。当我向选项卡1中的文本框添加值并触发提交按钮时,它无法识别哪个选项卡的提交被触发。

Hi,
I have a tab view named tab 1, tab 2, tab 3. Each tab is having its own text boxes. There is only one submit button available for all tabs. When I am adding values to text boxes in tab 1 and fired submit button it does not identify which tab's submit is fired.

推荐答案

您不需要区分点击。合乎逻辑并遵循用户的看法。如果您只有一个提交按钮,它可以在任何选项卡上运行,但从用户的角度来看,它适用于哪一个?当然,对于目前活跃的那个;当前只显示活动选项卡的选项卡页面,活动选项卡通常会显示一些有效的反馈。



或者,您可以在每个选项卡上放置不同的按钮实例。这也是一个合理的设计。



重要的是,对于每种情况,您都知道使用哪个标签页来获取提交数据。在第二种情况下,每个按钮都有其特定于标签页的处理程序,因此没有这样的问题。当你只有一个按钮实例时,如何处理你的情况?



你需要获得活动标签页。怎么样?我不知道你的标签控件是什么。例如,如果您的选项卡控件是jQuery UI Tabs Widget( https://api.jqueryui.com/tabs [ ^ ]),方法如下:

https://api.jqueryui.com/tabs/#option-active [ ^ ]。



如果你是使用别的东西,请自行查找这篇文章。



-SA
You don't need to "differentiate a click". Be logical and follow the user's look at it. If you have only one submit button, it works on any of the tabs, but for what one, from the user's point of view? Of course, for the one which is currently active; only the tab page of the active tab is currently visible, and the active tab usually shows some active feedback.

Alternatively, you put different instance of the button on each tab. This is also a reasonable design.

Importantly, for each case you know what tab page is used to get data for submission. In second case, each button has its tab page-specific handler, so there is no such problem. And how to do it with your case, when you have only one instance of the button?

You need to get the active tab page. How? I don't know what is your tab control. For example, if your tab control is jQuery UI Tabs Widget (https://api.jqueryui.com/tabs[^]), this is how:
https://api.jqueryui.com/tabs/#option-active[^].

If you are using something else, please find this piece of documentation yourself.

—SA


这篇关于所有标签的一个提交按钮。如何区分点击次数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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