Disable a button component onClick

hi,
I am work with JSF technology. I have a requirement based on command Button i.e..
can we create make a command button disabled on click and the request is to be send to the server
scenerio:
In my application if the user clicks multiple times the submit button. the application is throwing an exception. So I want to disable the submit button when the button is first clicked and the data is to be sent to the server.
I tryed this using JavaScript . I was able to disable the button on click but the request was not sent
can Anybody help me in solving this issue. I will be very thank full if i get the help.
thank you.

You can also use javascript instead.
onClick="window.setTimeout('document.getElementById(\'' + this.id + '\').disabled = true, 50);"
Dependent on the security requirements of your app you can't rely on this client side behaviour. The user could manipulate the request and invoke the action method, even if the button is disabled.

Similar Messages

  • Jsf and javascript to disable a button

    Hi
    is there a way to get the following code to disable the button called next
    when the button "btn" is clicked i call the javascript function myFunc but it does not disable the button called "Next"
    <html>
         <head>
              <title>Personal Info</title>
         </head>
         <body>
         <script type="text/javascript">
         function myFunc()
              document.personalForm.Next.disabled=true;    
         </script>
              <f:view>
                   <h:form id="personalForm">
                   <h:commandButton id="Next" value="Next" action="doSomething" />
                   <h:commandButton id="btn" value="button" immediate="true" onclick="myFunc()"  />
                   </h:form>
              </f:view>
         </body>
    </html>

    You should write Javascript according to the HTML source, not to the JSF code.
    View the generated HTML source and base your JS on that.

  • Changing The Text Color In a Radio Button Component

    Hi,
    I'm using a background in my frame , so I need to know how
    to change the color of the Radio Button Component. I tried using
    the Property Inspector , but in that the color option is disabled.
    The Flash version I'm using is Flash 8. Kindly provide me a
    solution for this.
    Thanks In Advance,
    Lokesh R

    There's a topic about this in the Flash help, about changing
    components. You need to edit the file inside your Flash
    installation folder, and make a copy of it to your liking.
    But about radio buttons: is there any way to include them in
    your project while maintaining the possibility of on(Keypress)
    events?

  • Use rich:fileUpload/ to enable/disable my buttons with checking file names

    Hello!
    I need to upload some files with using <rich:fileUpload>,and i did it but i need to check file names for some reasons and enable or disable upload button but my problem is that when i open my modal panel and click add button of <rich:fileUpload> and then add upload button of <rich:fileUpload>(not my upload button but upload button wich <rich:fileupload> has) i check file name but the button is not enable/disable until i close my modal panel and open it agin,so i need to know how to modify my code to make it work?
    <rich:modalPanel  id="uploadFile" autosized="true" resizeable="false">
                    <f:facet name="header">
                     <h:panelGroup>
                         <h:outputText value="uploadFiles"></h:outputText>
                     </h:panelGroup>
                 </f:facet>
                 <h:form>
                      <rich:fileUpload  maxFilesQuantity="#{uploadBean.maxUploadFiles}" allowFlash="true" fileUploadListener="#{uploadBean.uploadListener}" immediateUpload="false"/>
                             <table>
                                <tr>
                                     <td><h:commandButton disabled="#{!uploadBean.xlsNameValid}" rendered="#{!uploadBean.admin}"  action="#{uploadBean.upload}" value="upload" /></td>
                                     <td><h:commandButton action="#{uploadBean.clearFiles}" value="cancel" id="cancel"/></td>
                                </tr>           
                           </table>
                 </h:form>
                 <rich:componentControl for="uploadFile" attachTo="cancel" operation="hide" event="onclick"/>
              </rich:modalPanel>

    No the problem is that file is being checked on server side, but if file is invalid the button Upload(my button ,not standart rich:fileUpload) must be disbaled,and shown,but i have to close this modal panel and open it again to see my button enabled/disabled

  • Disable a button of the include page

    I am trying to disable a button on the include page using javascript's document.form.button.disable=true function. It works fine if I see just the include page in the browser but if I see the whole jsp page along with the include page, the button is not disabled. Can anyone help me here.
    Thanks in advance,
    snd

    The reason for this is due to the fact that the include page behaves like a component when the main page is loaded. This makes the attributes of the include page available to the main page, but restrictions are imposed on the realization of conditions applied on the include page when the main page is loaded. This results in the button becoming enabled.
    Suggest reworking on the logic or to handle the button in JSP itself.

  • How to disable the button???

    Hi, guys.
    I searched the forum, but did not find anything about disabling the button. There are examples of disabling text areas... But when i tried to implement same technics to disable a button, it did not work.
    I have a page with two regions items region and buttons region. When page opens i want to check if P1_TXT_BOX in items region is empty and if yes, disable button P1_CMD_DOTHIS in buttons region. And then onBlur for P1_TXT_BOX, if it is not empty - enable the button.
    Pls, help...
    Thnks.
    Mike

    Hi,
    I have always struggled with buttons and javascript in APEX because of the way it generates the buttons (as a "button" not "submit").
    A way round it would be to create the buttons using html then disabling the accept button:
    <input type="submit" id="P1_DOWNLOAD" value="Download" onclick="swapButtonStatus();" />
    <input type="submit" id="P1_ACCEPT" value="Acc" onclick="swapButtonStatus();" />
    <script>
    document.getElementById('P1_ACCEPT').disabled="true";
    </script>
    You just need to put them in the region footer or somewhere applicable.
    And use the following javascript function in the HTML Header:
    function swapButtonStatus()
    var downloadButton = document.getElementById('P1_DOWNLOAD');
    var acceptButton = document.getElementById('P1_ACCEPT');
    if(acceptButton.disabled=="")
    downloadButton.disabled="";
    acceptButton.disabled="true";
    //you can submit the button using: then create a process that
    //runs when request=Accept
    doSubmit('Accept');
    else if(downloadButton.disabled=="")
    acceptButton.disabled="";
    downloadButton.disabled="true";
    //you can submit the button using: then create a process that
    //runs when request=Download
    doSubmit('Download');
    Hope this helps
    Graham.

  • Disable Report Button Once Clicked.

    Apex 3.2
    In my application I have been able to disable html buttons, once the user has clicked them, using
    the following in the url of the button.
    javascript:this.disabled=true;this.value='Creating DC...';doSubmit('SUBMIT');
    I have several updateable reports, that contain buttons. I would like to disable these buttons, when clicked,
    but do not know how.
    At the moment the sql in the report for the button is
    '<input type="button" name="map" value="Add Mapping" onclick="mapdc(''mapdc'','||whid||')">'  map
    and I have some javascript in the page header
    <script language="JavaScript" type="text/javascript">
    function mapdc(Request, whid){
    var answer=confirm("Do you really want to map Whid " +whid+ " to Gwhid " +$v('P39_GWHID')+" ?");
    if(answer==true) {
      $x('P39_WHID').value = whid;
      doSubmit(Request);
    </script>
    Any ideas ?
    Gus

    Think I may have sorted this out,
    Changed my javascript to
    <script type="text/javascript">
    function runjob(request,jobid){
    var answer=confirm("Do you really want to run job id "+jobid+" ?");
    if(answer==true) {
      $x('P3_JOBID_2').value = jobid;
    $x_disableItem('P3_RUN_JOB',true);
    $x('P3_RUN_JOB').value = 'Running Job...';
      doSubmit(request);
    </script>
    and my sql to
    '<input type="button" name="run_job" value="Run Job" id="P3_RUN_JOB" onclick="runjob(''run_job'','||jobid||');">' end  run_job
    Gus

  • Trying to disable a button and code does not work help?

    I am trying to disable a button.
    I created a button by adding a display item and placing the following
    in the Pre Element Text:
    <input type="button"
    onclick="clickFunction('Confirmation message goes here')"
    value="Text to display on button"
    title="Tooltip text to display"
    style="" />
    I am trying to disable the button by doing any of the following and they all
    work on P9_VID but not on P9_MY_BUTTON Why?
    1
    document.getElementById('P9_VID').disabled=true;
    document.getElementById('P9_MY_BUTTON').disabled=true;
    2
    $x_disableItem('P9_VID',true);
    $x_disableItem('P9_MY_BUTTON',true);
    3
    html_GetElement('P9_MY_BUTTON').disabled = true;
    html_GetElement('P9_VID').disabled = true;
    4
    html_HideElement('P9_MY_BUTTON');
    html_HideElement('P9_VID');
    5
    $x('P9_MY_BUTTON').disabled = true;
    $x('P9_VID').disabled = true;
    Thanks
    Howard
    Edited by: csphard on Apr 1, 2010 1:56 PM
    Edited by: csphard on Apr 1, 2010 1:56 PM

    Howard
    Specify an id attribute for the button you created. Set the value for the id to be 'P9_MY_BUTTON'
    <input type="button" id = 'P9_MY_BUTTON'
    onclick="clickFunction('Confirmation message goes here')"
    value="Text to display on button"
    title="Tooltip text to display"
    style="" />varad

  • Can I disable the buttons on the side of my Nano 7?

    I keep my iPod Nano in my pocket frequently, and just about every time I do the device will start playing audio. After fiddling with it, I realized that I am pressing the "play" button just by moving my legs around. Is there any way to disable the play component on the volume button? The Settings menu is woefully sparse.

    You will need to have the iPhone's IMEI number registered with your service provider.  To fix your wi-fi try restarting your iPhone by holding down the on/off and the home buttons at the same time until you see the Apple logo.  If you are still having problems go into your settings>general>reset then tap reset network settings. 

  • Disabling the button till the response comes

    hi all
    i want the button to be disabled till the response has finished on clicking the button. Can anyone help how to do it.
    in java script it can be done, but it is painful for doing each and every form. so i want a centralized way for doing it.
    will the submit button help? we had lot of problem due to it when the load increased and several false records came due to clicking the button several times when response took a long time to come.
    in our project we will normal button and the action is executed using the action attribute.

    There is no other way than disabling the button with Javascript after onclick. Just create a simple function which does that and call that function in the onclick attribute.

  • How to disable a button once it has been clicked

    Hi!
    I need to disable a button once the user has clicked it! I also need the colour of the button to change once it has been clicked as well (I need it to just grey out - not sure if this can be solved using actionscript??)
    The only method I could think of of accomplishing this is to put each button in their own UILoader, but I'm hoping there is a simpler method!?

    Here's what you do:
    1. Open the Components panel and drag a button on the Stage (do NOT create button symbol).
    2. For now, give it an instance name of "aButton" - that's what the code below uses. However, you probably want to use a different name. Also, you can open up the Components Inspector panel (CS4) to change the label on the button - use the Component Parameters section on the Properties panel if you have CS5.
    3. In the Actions panel use this code:
    aButton.addEventListener(MouseEvent.CLICK, disableButtonHandler);
    function disableButtonHandler(event:MouseEvent):void
         //do whatever (gotoAndStop, fscommand...)
         aButton.enabled = false;
    4. Test it. If it was done correctly (I tested it on my computer), the button should deactivate and go greyish when clicked.
    Make sure you use a Button Component. I don't know it this code would work with a Button or a MovieClip symbol.

  • How to Disable default button

    Hi all
    I am running on EP 6 SP 9
    I have a JSPDynPage with a HTMLB form which has a default button set using the defaultButton attribute of the form
    <hbj:button
         id="OKButton"
         text="<%= localString %>"
         width="70"
         design="EMPHASIZED"
         onClick="Search"
         onClientClick="dounload();disableControl(this)"
         >
         <%
          searchForm.setDefaultButton(OKButton);
         %>
    </hbj:button>
    now in the disableControl method I need to disable the button OKButton.
    the following js fuction does exactly that, the button is grayed out and cannot be clicked with the mouse
    function disableControl(control){
      control.setDisabled();
    however if I press Enter key the form apparently attempts to invoke the eventhandler for this button, this throws a js error: Object doesn't support this property or method
    the funny thing is that the line(18) this error occurs on does not contain any js code.
    Has anyone had this same problem or is there another way to change the forms default button using js?

    >>Uma
    I already tried this.
    serchForm is undefined in js
    adding the line as server side code in the js doesnt work either
    <%
      searchForm.setDefaultButton(null);
    %>
    I also tried to get the form from the control this way in disableControl js function
    function disableControl(control){
      control.setDisabled();
      var jsForm = control.form;
      jsForm.setDefaultButton(null);
    jsForm is undefined in the last line
    does anyone know how to get a reference to the HTMLB form of the page using javascript?

  • Button component wierdness

    Player.fla and Controller.as are in the same folder.
    Player.fla:
    Button component in the library (with its assets). Document
    Class = "Controller". 1 layer, 1 frame. No code in timeline.
    Controller.as:
    (see attached code)
    My problem:
    I put a button on the stage, set instance name to
    playPauseBtn, change it's label to anything but "Label" in the
    Parameters panel, and for some reason the button cannot be disabled
    with code I attached.
    Not a critical problem because I can set playPauseBtn.label =
    '' in my class file and it will work, but why would the button
    component require a label of "Label" in the parameter panel to
    allow disabling?
    I can place the playPauseBtn.enabled = false in the time and
    it will work without any issues, but that's not what I want.
    Posted this issue at actionscript.org and other people are
    having the same problem... Is this a component bug?

    It seems that simply putting return; in a document class constructor function creates this problem. In my code below, if I simply comment out the return;, labels appear. If I leave return; inside the constructor, all UIComponent labels go to their default state. Looks like a bug.
    This is the document class:
    package
    import flash.display.*;
    public class theDoc extends MovieClip
    public function theDoc()
       return;
    Then create an FLA and put a UIComponent button onstage. Label it something. Assign the document class to the above AS. Test movie. comment/un-comment the return; and watch the button behavior. Why is this?

  • Disabled Submit Button

    At the time of submit the submit button is disabled. Is there a way to disable this functionality for certain form?

    by default, on nextensio forms, it is done automatically, but what you seek is done by javascript. something like:<br /><br />I found this here: http://www.houseofscripts.com/scripts/javascripts/disablebut.htm <br /><br />As you can see, this code allows us to do disable any button - either Submit or Button.<br />Just add onClick="Disab (1)" <br /><HTML><br /><HEAD><br /><br /><SCRIPT LANGUAGE="JavaScript"><br /><br />function Disab (val) {<br /><br />if(val=="1") <br />{form1.Submit.disabled=true}<br /><br />if(val=="2") <br />{form1.Button.disabled=true}<br />}<br /><br /></SCRIPT><br /><br /></HEAD><br /><BODY TEXT="000000" BGCOLOR="FFFFFF"><br /><br /><FORM name="form1" method="post" action=""<br />enctype="text/plain"><br /><input type="submit" name="Submit" value="Submit" onClick="Disab (1)"><br /><input type="button" name="Button" value="Button" onClick="Disab (2)"><br /></FORM><br /><br /></BODY><br /></HTML>

  • How do I disable "Exceptions" button for "Block pop-up windows" in Content tab?. I am able to Disable other Exception buttons in this tab using about:config preference.

    Need a way to disable "Exception" button for "Block Pop-up windows" in Tools-> Options -> Content tab. I want to be able to do this for Locking Down Firefox preferences.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    That button doesn't have a pref associated with it, so you can't disable that button with a pref on the about:config page or a lockPref call.
    That only leaves the choice to remove that button with code in userChrome.css
    <pre><nowiki>#popupPolicyButton {display:none!important;}</nowiki></pre>
    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files

Maybe you are looking for