标签: button

最初在disable ="true"时<p:commandButton>不工作

这是我的ManagedBean:

@Named(value = "mrBean")
@RequestScoped
public class MrBean {

   public void laugh() {
      System.out.println("HAHAHA");
   }

   public void prepareToLaugh() {
      System.out.println("Drink water.");
   }

}
Run Code Online (Sandbox Code Playgroud)

这是我的commandButton的工作版本:

<p:commandButton actionListener="#{mrBean.laugh}" widgetVar="laughtButton"
                 value="Laugh" oncomplete="laughButton.disable();"  />
Run Code Online (Sandbox Code Playgroud)

当我点击上面的按钮时,我看到HAHAHA了按钮被禁用.但是,当我将laughButton的disable属性设置为时true,该按钮不再起作用:

<p:commandButton actionListener="#{mrBean.laugh}" widgetVar="laughtButton"
                 value="Laugh" disabled="true" oncomplete="laughButton.disable();"  />

<p:commandButton actionListener="#{mrBean.prepareToLaugh}"
                 value="Prepare to laugh" oncomplete="laughButton.enable();" />
Run Code Online (Sandbox Code Playgroud)

当我点击第二个按钮时,我看到Drink water并启用了第一个按钮.但是,当我点击第一个按钮时,没有任何反应.

如果有人能就如何解决这个问题给我一个建议,我将非常感激.我正在使用PrimeFaces 3.0 RC2.

jsf button primefaces

3
推荐指数
1
解决办法
8554
查看次数

按下WPF按钮视觉状态,按钮失去焦点后保持视觉状态"运行"

我正在使用wpf c#Window.我有一个像这样定义的按钮:

<Button x:Name="but" Style="{DynamicResource ButtonStyle13}" / >
Run Code Online (Sandbox Code Playgroud)

我的ButtonStyle是这样的:

<VisualState x:Name="Pressed">
 //bla bla (my style) goes here
Run Code Online (Sandbox Code Playgroud)

现在,当我使用这种视觉状态时,按下按钮时视觉正在改变但后来恢复正常.我希望按钮处于"按下"状态,它将保持"按下"直到我按下另一个按钮.

我尝试像这样改变它:

<VisualState x:Name="myPre">
Run Code Online (Sandbox Code Playgroud)

然后在代码中使用:

 VisualStateManager.GoToElementState(but, "myPre", true);
Run Code Online (Sandbox Code Playgroud)

完全没有剂量.然后我用了

 VisualStateManager.GoToState(but, "myPre", true);
Run Code Online (Sandbox Code Playgroud)

只要鼠标悬停在按钮上,这就会按下我的按钮,但是当它失去焦点(鼠标移动)时,它会恢复正常.

我希望我已经清楚了.如何使按钮保持在按下的视觉状态,直到我决定(在代码内)取消该按钮?

wpf button

3
推荐指数
1
解决办法
4206
查看次数

禁用表单提交,直到选中(两个)复选框

我们有一个表格,在表格之前我们有两个复选框.

  1. 隐私
  2. 条款和条件.

我想要做的是(无法通过复选框验证)是禁用提交按钮,直到两个复选框都被选中.

这些的HTML是:

<label class="s_radio"><input type="checkbox" class="required" id="terms"/> <a class="s_main_color" href="/terms">Terms</a></label>
<label class="s_radio"><input type="checkbox" class="required" id="privacy"/> <a class="s_main_color" href="/privacy">Privacy Policy</a></label>
Run Code Online (Sandbox Code Playgroud)

用于验证这些的js(虽然不起作用)

if(terms == "") $('#terms').css({"outline-color":"#F12B63"});
if(privacy == "") $('#privacy').css({"outline-color":"#F12B63"});
Run Code Online (Sandbox Code Playgroud)

jquery button

3
推荐指数
1
解决办法
3130
查看次数

如何使用fancybox按钮助手+ fancybox缩略图助手?

我需要同时使用它们(fancybox按钮助手和缩略图助手)

我一次只能使用其中一个.

以下是每个功能的示例:http: //fancyapps.com/fancybox/#examples

已经尝试过使用这两个类:

<a class="fancybox-buttons fancybox-thumbs"    
Run Code Online (Sandbox Code Playgroud)

但它不起作用......一次只有一个,如:

<a class="fancybox-buttons"    
Run Code Online (Sandbox Code Playgroud)

要么

<a class="fancybox-thumbs"     
Run Code Online (Sandbox Code Playgroud)

.

这些是每个的javascripts:

            /*
            Button helper. Disable animations, hide close button, change title type and content
        */

        $('.fancybox-buttons').fancybox({
            openEffect  : 'none',
            closeEffect : 'none',

            prevEffect : 'none',
            nextEffect : 'none',

            closeBtn  : false,

            helpers : {
                title : {
                    type : 'inside'
                },
                buttons : {}
            },

            afterLoad : function() {
                this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length …
Run Code Online (Sandbox Code Playgroud)

jquery helper thumbnails button fancybox

3
推荐指数
1
解决办法
3万
查看次数

Android - 带图像的按钮 - 禁用按钮时的暗淡图像

在Android中,我有一个包含图像和文本的按钮.禁用该按钮时,文本将自动显示为灰色,但图像保持不变.如果禁用按钮而没有两个单独的图像,是否可以使图像变暗?

android image button

3
推荐指数
1
解决办法
6569
查看次数

如何按一次按钮然后不再按下了?

我有一个按钮

    <Button 
    android:layout_above="@id/choice2"
    android:layout_centerHorizontal="true"
    android:textColor="#FFFF00"
    android:textSize="25sp"
    android:gravity="center"
    android:background="@drawable/loginbutton"
    android:layout_height="30dp"
    android:layout_width="fill_parent"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:text="@string/q1a1"
    android:id="@+id/choice1">
</Button>
Run Code Online (Sandbox Code Playgroud)

当你按下这个按钮时,它会向计数器/记分员增加10.如何使此按钮能够被按下一次,但之后又不能按下?用户可以多次作弊并按下该按钮,以便为该分数添加更多内容.

android view button imagebutton relativelayout

3
推荐指数
1
解决办法
8557
查看次数

如何隐藏FileUpload控件的"TextBox"?

在我的ASP.NET页面中,我使用的是"FileUpload"控件.整个事情已经实现并且按预期工作但是...我不希望TextBox控件是"FileUpload"的一部分.(FileUpload = TextBox + Button)

是否有可能只删除/隐藏TextBox并让Button看起来像LinkBut​​ton?

谢谢

asp.net textbox file-upload button hide

3
推荐指数
1
解决办法
2万
查看次数

javascript - 单击按钮时调用函数

有人能告诉我这里我做错了什么吗?

我试图在单击按钮时执行一个功能.

HTML:

<button id="btn1">Press me!</button>
<input type="button" id="btn2" value="Press me!"/>?
Run Code Online (Sandbox Code Playgroud)

javascript:

var btn1 = document.getElementById('btn1'),
    btn2 = document.getElementById('btn2');


function do() {
    alert('Yay!');
}
btn1.onclick = do;
btn2.onclick = do;?
Run Code Online (Sandbox Code Playgroud)

这是一个演示.我不确定为什么它不起作用.对于我来说,这显然是一种显而易见的方式.:)

html javascript function unobtrusive-javascript button

3
推荐指数
1
解决办法
8955
查看次数

多个类中的Java按钮操作

在Java中工作:我有一个JFrame类,我的两个单独的类JPanels被添加到JFrame.其中一个JPanel类中有一些按钮,可以互相交互(当我点击一个按钮时,它可以禁用另一个按钮).但是,我无法弄清楚如何让按钮在另一个中调用一个方法JPanel(在一个单独的类中编写).

所以,我的程序看起来像这样:

的JFrame

  • JPANEL1
  • Jpanel2 - 这个类里面有我的按钮,我试图让它们与JPanel1对象进行交互.

任何提示赞赏,谢谢!

java oop methods swing button

3
推荐指数
1
解决办法
1500
查看次数

如果文本字段为空,则禁用Android按钮

有人可以告诉我如何禁用Android中的按钮,除非所有三个editText字段都填满了吗?我不知道在这里包含条件语句的位置以及如何将它放在按钮侦听器的上下文中.

这是我的主要活动代码.

package com.amritayalur.mypowerschool;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;



public class MyPowerSchoolActivity extends Activity {
Button buttonSubmit;
TextView textViewTitle;
TextView textViewDesc;
EditText editTextURL, editTextUser, editTextPass;

String url = "";
 String str;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    buttonSubmit = (Button) findViewById(R.id.buttonSubmit);
    textViewTitle = (TextView) findViewById(R.id.textViewTitle);
    textViewDesc = (TextView) findViewById(R.id.textViewDesc);

    editTextURL = (EditText) …
Run Code Online (Sandbox Code Playgroud)

layout android button android-edittext

3
推荐指数
1
解决办法
1万
查看次数