Disable button using javascript

Hi,
I'm sorry if this is a relatively simple problem, but I have tried several things and have searched the forum, but still no luck!
I am trying to get a button in a form to be disabled or hidden on loading the page and only to become enabled or shown once an 'onclick' event occurs. I already have a javascript function running successfully on the 'onclick' event, so there is no problem with that.
Preferably I would like the button to be template driven, but I realise that disabling/hiding it may only be possible with an HTML button.
I have tried the following JavaScript, but it appears to do nothing:
document.getElementById('P6_OK').disabled=true;
$x_HideItemRow('P6_OK');
If the JavaScript is ok it is probably the way I am implementing it into the HTML.
Thanks
Lucy

Hi,
I'm still having troubles with this (see above). If anyone has successfully managed to disable a button using JavaScript I would be interested in how they did it.
To clarify, I have tried the following two pieces of script, among others:
(1) document.getElementById('P6_OK').disabled=true;
(2) $x_HideItemRow('P6_OK');
I have read quite a few forum links and followed what others have done, but in vain.
Thanks for your help
Lucy

Similar Messages

  • Associating two events with submit button using  javascript in jsp

    Hi
    How can i Associate two events with submit button using javascript in jsp. Firstly it should insert the data to database and secondly it should close the same pop-up window

    Have something like :
    <input type="submit" name="submitbtn" value="Click me" onClick="function1(); function2(); " />
    You just call both functions sequentially, it's that simple. Although using javascript to work with a database, that seems a bit tricky.

  • Hide an HTML button using javascript

    Hi,
    I need to hide an html buttton using javascript. I have an radio button with values "YES" and "NO". If is select NO then i need hide the button without refreshing the page. Can anyone suggest me how to hide an button using javascript.
    Thanks
    Prashanth

    Prashanth,
    The exact solution will vary based on a few factors. The basic idea is to place an event handler on the radio button item that calls a function to hide/show the button. You might also want to call that function when the page loads too.
    If you put an example page on apex.oracle.com and provide the workspace/username/password I'll take a look. You can create a new account for this purpose.
    Regards,
    Dan
    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • How to Disable a Button Using JavaScript

    Hi,
    I want to disable a button based on a condition. I am using a template based button (button Alternate 3). I am using Theme 3. I have created buttons of type item but when I view the source there is no button name populated in the html. My javascript is not disabling the button.
    Please advice.
    Thanks
    sukarna

    Hi,
    You can't disable an A tag (FireFox, for example, will still let you click the "link").
    What you could do would be to create a second button that doesn't work and only show one of these at a time.
    I have done that here: [http://apex.oracle.com/pls/otn/f?p=35917:30]
    The Button has been based on a custom Button Template. The definition for this is:
    &lt;table class="t10Button" cellspacing="0" cellpadding="0" border="0"  summary="" id="#BUTTON_ATTRIBUTES#"&gt;
    &lt;tr&gt;
    &lt;td class="t10L"&gt;&lt;a href="#LINK#"&gt;&lt;img src="#IMAGE_PREFIX#themes/theme_10/button_left.gif" alt="" width="4" height="24" /&gt;&lt;/a&gt;&lt;/td&gt;
    &lt;td class="t10C"&gt;&lt;a href="#LINK#"&gt;#LABEL#&lt;/a&gt;&lt;/td&gt;
    &lt;td class="t10R"&gt;&lt;a href="#LINK#"&gt;&lt;img src="#IMAGE_PREFIX#themes/theme_10/button_right.gif" width="4" height="24" alt="" /&gt;&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table class="t10Button" cellspacing="0" cellpadding="0" border="0"  summary="" id="#BUTTON_ATTRIBUTES#_DISABLED" style="display:none"&gt;
    &lt;tr&gt;
    &lt;td class="t10L"&gt;&lt;img src="#IMAGE_PREFIX#themes/theme_10/button_left.gif" alt="" width="4" height="24" /&gt;&lt;/td&gt;
    &lt;td class="t10C" style="padding:1px 4px;"&gt;#LABEL#&lt;/td&gt;
    &lt;td class="t10R"&gt;&lt;img src="#IMAGE_PREFIX#themes/theme_10/button_right.gif" width="4" height="24" alt="" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;This actually creates two buttons - the first one, which actually has the link, is visible to start with. The second one, which has no link at all, starts off as invisible.
    Both buttons use the #BUTTON_ATTRIBUTES# setting to get the button name into the ID - though the second button adds "_DISABLED" to this so that it has a unique, but known, ID
    Then it is just a case of calling a function to show one button and hide the other or vice versa:
    &lt;script type="text/javascript"&gt;
    function disableButton()
    document.getElementById('P30_TEST_BUTTON').style.display = "none";
    document.getElementById('P30_TEST_BUTTON_DISABLED').style.display = "block";
    function enableButton()
    document.getElementById('P30_TEST_BUTTON').style.display = "block";
    document.getElementById('P30_TEST_BUTTON_DISABLED').style.display = "none";
    &lt;/script&gt;Another possibility is to add the #BUTTON_ATTRIBUTES# to the TABLE tag instead of the A tag in a new button template (based on a copy of the normal Button template). Then, the ID value would be applied to entire "button". You can then make this invisible using:
    $x('BUTTON_ID').style.visibility = 'hidden';The button will be removed from the page as far as the user is concerned, so they can not click the link.
    Andy

  • How to create a disabled button without javascript

    Hi,
    I have to create a disabled button in apex 4, without using javascript due to some security reasons. I have edited the button template to give a disabled look, but still an action eg. submit is associated with it. I dont want any action to be performed on this button.
    Please suggest how can i achieve this or any alternative approach.
    Regards,
    Shweta

    Shweta wrote:
    Hi,
    I have to create a disabled button in apex 4You ALWAYS need to supply the following information with the initial question:
    <li>Full APEX version
    <li>Full DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s)/versions(s) used
    <li>Theme
    <li>Templates
    <li>Region type
    without using javascript due to some security reasons.Why? What "security reasons"?
    I have edited the button template to give a disabled look, but still an action eg. submit is associated with it. I dont want any action to be performed on this button.
    Please suggest how can i achieve this or any alternative approach.If no action can be performed on the button, why is it there? Don't render it all.

  • Selecting or highlighting node or mesh by button using javascript

    Hi
    I have 3D pdf model with node 1001 or mesh name 2002 and when I klick it by mouse on 3D view it is highlighted and get orange boundary box.
    I have created button name 1001 button and I would like to add to this button javascript function which will highlight this node or mesh in the same way as click on those.
    I found in discusion some way of make it for example red by changing rendering mode to illustration but it is not what I am trying to do. I asking if it is possible just select from button using name of node or mesh. if you have any exmaple of script i will be very pleased.

    thanks for answer.
    It is not what I want to do
    I have 5 layer and on each layer I have one node and under neath one mesh.
    I would like to select node or mesh by clicking button created on page not by clicking in 3d model or Model Tree. Like below bottles are selected (highlighted).
    NowI doing it like that:
    BUTTON 1-----------------------------------------------
    myAnnotObj = getAnnots3D(0)[0].context3D;
    myAnnotObj.scene.defaultRenderOptions.illustrationRenderModeFaceColor.set( 1, 0, 0 );
    for (var i = 0; i < myAnnotObj.scene.meshes.count; ++i)
    mesh = myAnnotObj.scene.meshes.getByIndex(i);
    mesh.renderMode = "solid";
    HighlObj = myAnnotObj.scene.meshes.getByName("1001");
    HighlObj.renderMode = "illustration";
    BUTTON 2-----------------------------------------------
    myAnnotObj = getAnnots3D(0)[0].context3D;
    myAnnotObj.scene.defaultRenderOptions.illustrationRenderModeFaceColor.set( 1, 0, 0 );
    for (var i = 0; i < myAnnotObj.scene.meshes.count; ++i)
    mesh = myAnnotObj.scene.meshes.getByIndex(i);
    mesh.renderMode = "solid";
    HighlObj = myAnnotObj.scene.meshes.getByName("2002");
    HighlObj.renderMode = "illustration";
    in this method I have to clean old selection in the loop doing this render mode back to solid. In the same time my selection not working at all in render mode illustration. So I would like to find how to select like in picture from button in document. by script.

  • Adobe Reader Submit Button using JavaScript

    We have a form that when submitted it needs to use javascript to update the Subject Line of the email message for our workflow process. This process works absolutely great when using Acrobat. However, when sent to someone using Reader (even with JavaScript enabled through preferences) nothing happens when the button is clicked. The form was designed in Acrobat 10 Professional.
    Here is the JavaScript we are using...
    var wsuid = this.getField ("mywsuid");
    var d = new Date();
    var month = d.getMonth()+1;
    var day = d.getDate();
    var year = d.getFullYear();
    var today = ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + '/' + day +  year;
    var name = this.getField("name");
    var subject = "subject: " + (wsuid.valueAsString) + ":" + (name.valueAsString) + ":" + (today);
    this.mailDoc({
        bUI: true,
        cTo: "[email protected]",
        cCc: "",
        cSubject: subject,
    Suggestions on getting this to work with Acrobat Reader is much appreciated.
    Dawn Bleuel
    Wichita State University

    I was able to open the JavaScript debugger in Acrobat Pro. When the document is Reader Enabled, I get the following message:
    Acrobat EScript Built-in Functions Version 10.0
    Acrobat SOAP 10.0
    NotAllowedError: Security settings prevent access to this property or method.
    Doc.subject:15:Field Submit:Mouse Up
    And in Acrobat Pro - I now see Protected View is set to Off.

  • Toggle Image Buttons using Javascript - How?

    Hi,
    Hoping someone can assist me with javascript and how to toggle buttons.
    My scenario is as follows - I have two buttons side by side, say Button_A and Button_B but I also have two other buttons, i.e Button_C and Button_D which are not displayed at start-up, only Button_A and Button_B are displayed.
    With javascript, I need a means of switching buttons over the top of Button_A and Button_B, i.e if I press Button_B, Button_A gets replaced with Button_C and Button_B gets replaced with Button_D.
    At the moment, each button is inside unique div id, and each button is displayed as an image within an img tag.
    Also need a means of accessing buttons via javascript, even if I haven't actually clicked that particular button, i.e if I click Button_B which fires an onclick event, I need to perform operations on Button_A as well. Unsure how to access Button_A object?
    Any assistance on the above would be much appreciated.
    Thanks,
    Tony.

    Hi,
    It sort of helps but lets say in your example you had another image column called IMAGE2, which had a image of a green circle, so that when you clicked on the green tick within your IMAGE column, this changed to a red cross as it does now but at the same time, also toggled the green circle to a blue square, even though you didn't click on this green circle image, just on the green tick.
    How might this be done in Javascript?
    Hope this makes sense.
    Thanks.
    Tony.

  • How to select a radio button using javascript?

    Hi,
    I have 2 radio buttons as shown below:
    <input id="poBoxRadio" name="poBoxRadio" type="radio" class="radio-btn" value="No" /> No
    <input id="poBoxRadio" name="poBoxRadio" type="radio" class="radio-btn" value="Yes" /> YesI want to select one of this radio button, according to the following condition in javascript:
    <script type="text/javascript">
    if (<%=option1%> != ""){
         // Radiobutton "No" should be selected.
    else if (<%=option2%> != ""){
         // Radiobutton "Yes" should be selected.
    </script>How can I do this in Javascript? Any help will be highly appreciated.
    Thanks,
    Rishi

    I have solved this issue using the following:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    var a='', b='d';
    </script>
    </head>
    <body>
    <input id="poBoxRadioNo" name="poBoxRadio" type="radio" class="radio-btn" value="No" /> No
    <input id="poBoxRadioYes" name="poBoxRadio" type="radio" class="radio-btn" value="Yes" /> Yes
    <script type="text/javascript" defer="defer">
    <!--
    if(document.getElementById){
    if (a != ""){
    // Radiobutton "No" should be selected.
    document.getElementById('poBoxRadioYes').checked = false;
    document.getElementById('poBoxRadioNo').checked = true;
    else if (b != ""){
    // Radiobutton "Yes" should be selected.
    document.getElementById('poBoxRadioNo').checked = false;
    document.getElementById('poBoxRadioYes').checked = true;
    // -->
    </script>
    <input disabled type="button" value="UP" onclick="setVariable('move=1')">
    </body>
    </html>Thanks to all of you!

  • Referencing a button using javascript

    Hi there
    Does anyone know how to reference a button (button in region position) in javascript? I have tried using document.getElementById(<button name>).disabled=true and document.getElementByName(<button name>).disabled=true and keep getting errors. I am needing this to enable and disable a button depending on a value selected from a select list.
    Cheers
    Heidi

    Hi,
    Try this:
    Use this in your JavaScript code.
    $('button[type="button"][value="Cancel"]').attr('disabled', 'disabled');It is a jQuery code which I tried on a template based button with Text Label/Alt as "Cancel"
    which is used in above code *[value="Cancel"]*.
    The normal disabling mechanism with above methods don't work on Template Based Button
    as it is not constructed using <input></input> internally in ApEx but using <button></button>
    and hence they do not have any attribute id.
    Hope this helps!
    Regards,
    Kiran

  • Custom print button using javascript for landscape document

    I am working on a document that has 50+ pages and am wanting to have a print button on most of them to print the exact page. The document is landscape and I need the "Auto-Rotate and Center" toggle to be checked on, but I don't know how to code that. This is what I have so far:
    this.print({
    bUI: true,
    bSilent: false,
    bShrinkToFit: false,
    nStart: 2,
    nEnd: 2
    Does anyone know how to get the "Auto-Rotate and Center" checked on and where to add it to the code?
    Thanks so much for any help.

    Hi Jaydeep,
    I had already debugged and removed
    'Include(Users)'. 
    if i remove 'Include(Users)'. i'm not getting user enumerator. It will be empty.
    Since there are no users loaded in the object, the entire function not working.
    Thanks,
    Bharath P N
    P N Bharath

  • How to set a page parameter using javascript ?

    Hi:
    i'd like to set page parameter with a value taken from a textbox when clicking a button using javascript code.
    i mean, i have a textbox and a button using javascript and i want to take the value from the textbox and when onClick event happens set that value to the page parameter. How can i do this????
    Thanks.
    Best regards. Urko.

    Hi,
    Can you please elaborate your requirement. May be some better ways can be suggested. Also please mention which component you are using.
    Thanks,
    Sharmila

  • Run PLSQL code by click on button usin javascript

    Hi
    I want to run plsql code
    on click button using javascript
    javascript is ok but code of plsql is not run
    suggest me
    APEX 4.2.1
    Oracle !!XE
    Windows Server
    Firefox 17.0.1
    Theme Cloudy
    thanks in advance
    bUTTON CODE IN PLSQL CODE AND SEND_RMNDE IS PROCEDURE
    '<button type="button" name="button1" onclick="send_rmndr('
    ||NO_DUES_MASTER.CERT_ID
    ||');" value ='
    ||NO_DUES_MASTER.CERT_ID
    ||'> '
    ||'Remind'
    ||'</button>'
    JAVASCRIPT
    <script type="text/javascript">
    function send_rmndr(pThis)
    var params='x= '+pThis;
    var get=new htmldb_Get(null,null,null,&APP_PAGE_ID.,null,'send_reminder',params);
    gReturn = get.get();
    //alert(gReturn);
    alert ('inside script ' +params);
    //get=null;
    </script>
    Edited by: 969091 on Feb 1, 2013 9:13 PM

    send_reminder needs to be defined as an application process
    Alternatively, you can define a dynamic action and do this more declaratively.
    It's easy to define a DA that fires on click of a button that runs PL/SQL, and you can also define which page items are sent to and received from the plsql via session state.
    Scott
    blog: [url grassroots-oracle.com]grassroots-oracle.com
    twitter: [url twitter.com/swesley_perth]@swesley_perth
    -- please mark any useful posts as helpful or correct, in the end it helps us all

  • Screen Personas 2.0 Enable/Disable script button in Javascript

    Hi,
    Has anyone tried enabling or disabling script buttons on a flavor using Javascript. I have two script buttons,
    The first one (Button1) searches for a contract based on the contract id provided by the user in a text box. (So, the script triggers the transaction me33k, fetches and displays the relevant fields in the flavor)
    Now, based on whether the contract is present in the system the user needs to click another script button (Button2) which will allow him to create an order. Currently the button is disabled (ScriptButton.IsEnabled = false in the Properties menu).
    In the Button1 script towards the end, I need to enable Button2 is a contract is found. So in the Button1 script, at the final step I try to calculate in JS and write the following JS code,
    var args.btn2id = document.getElementById("Personas/blahblahblah");
    args.btn2id.disabled = false;
    But this is never works. And I have noticed that the control id does not return the control object in Javascript (so, args.btn2id is always null) and I tried removing the '/' and various other options.
    Has anyone ever tried to enable/disable buttons in Personas? Is it even possible?
    Abhijeet

    You don't have access to the Personas control properties from JavaScript to dynamically change them.
    About the only thing that comes to mind is Tobias' method to hide the script button if you want to disable it.

  • How to set radio button from radio group using javascript, HTMLB

    Hi guys,
    I am trying to set one radio button as checked, from my radio button group using javascript.
    This is the code:
         <hbj:radioButtonGroup id='TRAIN_SUB' columnCount="1">
              <hbj:radioButton id="TRAIN_SUB0" text="Not Applicable" key="NA" disabled="true" /> 
              <hbj:radioButton id="TRAIN_SUB1" text="SDF" key="SDF" disabled="true" jsObjectNeeded="TRUE"/>               
         <%     
              ssTrainSubsidy = new String(MAIN_FORM.getParamIdForComponent(TRAIN_SUB));
         %>
         </hbj:radioButtonGroup>
    in javascript, i am using this:
                   /document.getElementById('<%= ssTrainSubsidy%>')[2].checked =true;
    I also tried to access the radiobutton directly, using
              ssTrainSubsidy0 = new String(MAIN_FORM.getParamIdForComponent(TRAIN_SUB0));
    but it has null pointer error.
    but always have error, anyone can help? thanks!!
    Edited by: Feng Guo on Aug 12, 2010 3:44 PM

    document.getElementById(radioid).checked =true;
    this code will work to select the radio button (set). i think there is a error in the id you placed in ID. place the Radio butoon id and check again. Check this thread on [setting a Radio button|Setting HTMLB RadioButtonGroup Selection using JS;
    regards,
    Mahesh

Maybe you are looking for

  • How can i use Flash Drive in V880 with Solaris 8

    i want mount pen drive(flash drive) in my V880 server where i install Solaris 8. so what is the procedure? thanks

  • How to have some top level menu items not be hyperlinks

    I have a navigation band where 5 of the 6 top level items need to NOT be hyperlinks but simply "category titles" that you mouseover to display the submenu - which are the links to web pages. An example of this is on the Amazon.com home page - the ite

  • Problem with EventListener

    As I've stated in all my recent posts to this forum, I'm a total newbie at AS and need all the help I can get. I've got a button (one of several, but I'll concentrate on one for now) and I want to use a Listener in order to have the button click carr

  • Answers error

    Hi, My report has morethan 50 columns. When i ran this report in OBIEE Answers i am getting this error. State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 46036] Internal Assertion: Condi

  • Am I able to put programs like Adobe Photoshop Lightroom onto an iPad?

    I am looking to upgrade my computer to an iPad and I want it to have Adobe Lightroom 4 on it. I would also like to put other things like Diablo on it. Is that a possibility?