Disable HTMLB dropdown with JavaScript

Hi All,
I ran into the following issue:
I have a BSP page that used HTMLB dropdowns and some custom javascript that disabled those dropdowns interactively when a user clicked on a checkbox.
Example: tempDropdown.disabled = true;
Unfortunately, as soon as I changed the control rendering attribute to "SAP", the look&feel of dropdowns changed and they no longer appear to be based on "select-one" HTML object. Therefore, my custom JavaScript no longer works.
Do you know how I could visually (interactively) disable the "SAP" rendered HTMLB dropdown with a custom javascript?
Thanks!
Roman

here is the complete code of my sample.
<b><u>page attribute</u></b>
tab1     TYPE     TIHTTPNVP
tab1_wa     TYPE     IHTTPNVP
tab2     TYPE     TIHTTPNVP
tab2_wa     TYPE     IHTTPNVP
<b><u>layout</u></b>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003"  controlRendering="SAP" >
  <htmlb:page title=" " >
    <htmlb:form>
      <%
  clear tab1_wa .
  refresh tab1 .
  move: 'PRI' to tab1_wa-name ,
  'Printer' to tab1_wa-value .
  append tab1_wa to tab1 .
  move: 'FAX' to tab1_wa-name ,
  'Fax' to tab1_wa-value .
  append tab1_wa to tab1 .
  move: 'EMA' to tab1_wa-name ,
  'Email' to tab1_wa-value .
  append tab1_wa to tab1 .
      %>
      <%
  clear tab2_wa .
  refresh tab2 .
  move: '[email protected]' to tab2_wa-name ,
  'Some One' to tab2_wa-value .
  append tab2_wa to tab2 .
  move: '[email protected]' to tab2_wa-name ,
  'Mr X' to tab2_wa-value .
  append tab2_wa to tab2 .
  move: '[email protected]' to tab2_wa-name ,
  'Mr Y' to tab2_wa-value .
  append tab2_wa to tab2 .
      %>
<script language="javascript">
  function SetDisabled(elem,disable)
  var ip = document.getElementById(elem);
  ip.disabled = disable ;
</script>
      <htmlb:label for  = "DDLB1"
                   text = "Carrier" />
      <htmlb:dropdownListBox id                = "DDLB1"
                             nameOfKeyColumn   = "NAME"
                             nameOfValueColumn = "VALUE"
                             table             = "<%= tab1 %>"
                             onClientSelect    = "javascript:dd = document.forms[0].DDLB1; alert(dd.options[dd.selectedIndex].value);"
                             width             = "150" />
      <htmlb:dropdownListBox id                = "DDLB2"
                             nameOfKeyColumn   = "NAME"
                             nameOfValueColumn = "VALUE"
                             table             = "<%= tab2 %>"
                             width             = "150" />
      <htmlb:button text          = "Press Me"
                    onClientClick = "javascript:SetDisabled('DDLB2', 'true');" />
    </htmlb:form>
  </htmlb:page>
</htmlb:content>
try this in your system and let me know whether it works or not
Regards
Raja

Similar Messages

  • JavaScript for disabling htmlb elements

    Hello,
    in my bsp application i want to change the attribute disabled of htmlb:inputfields and htmlb:dropdownlistbox. I used following javascript:
    document.getElementById('controllerID_inputfieldID').disabled = 'true';
    document.getElementById('controllerID_inputfieldID').disabled = '';
    This isn't work right, because the disabled is displayed other than I set disabled in the htmlb tag (<htmlb:inputField id = "inputfieldID" disabled = "true") and I can choice a element in the dropdownlist.
    What is the correct javascript function for disabling htmlb elements?
    Tina

    I believe that the following will work for you, although I must caution that it is not likely supported by SAP. Any service pack upgrade or patch may break this code. Use at your own caution.
    This is from a function that can disable or enable different objects using Javascript. Setting the st attribute seems to be what it takes to make it readOnly. Setting the class just applies the disabled look.
          case "DROPDOWN":
            switch(mode)
              case "DISABLED":
                window.document.getElementById(ID).st = "r";
               window.document.getElementById(ID).className = "urCoB2TxtDdl urCoB2Ro";
                break;
             case "ENABLED":
                window.document.getElementById(ID).st = "";
                window.document.getElementById(ID).className = "urCoB2TxtDdl";
               break;
           break;

  • Set Selection of htmlb Dropdown

    How do i set the htmlb Dropdown selection in the Javascript with the value selected? It getz populated with Model from bean.
    <hbj:dropdownListBox      
                             id = "myDdBox1"
                                            disabled = "false"
                             model = "myBean.model"
                             selection = "<%=myBean.getSelection()%>"
                         jsObjectNeeded = "TRUE"
                                                      onClientSelect = "Event()">
    </hbj:dropdownListBox><br><br>
    <script>
             var funcName = htmlb_formid+"_getHtmlbElementId";
              func = window[funcName];
              var dropdown = eval(func("myDdBox1"));
    what shud i do here??
    </script>
    Shud i add this also?
    var form = document.all(htmlb_formid);
    form.submit();

    var funcName = htmlb_formid+"_getHtmlbElementId";
    func = window[funcName];
    var dropdown = eval(func("myDdBox1"));
    //you need to provide the index
    dropdown.setSelectedIndex("1");
    //or you can set the value
    dropdown.setValue("elephant");
    Message was edited by: Prakash  Singh

  • HTMLB eventing using javascript

    Hello experts,
    I have a requirement which i am unable to figure out how to do it .
    I have HTMLB dropdown in which the items are popolauted using listitembox. Now my requirement is to disable another drop down depending upon the value selected in this dropdown .
    There is no controller in this PDK component . Hence need to use javascript to handle this . But not able to do it.
    Could anyone help me in resolving this .
    Points will be awared.
    Regards,
    Pratima.

    Hi,
    never used, but found here: [http://www.sapdesignguild.org/resources/htmlb_guidance/index.html|http://www.sapdesignguild.org/resources/htmlb_guidance/index.html] in this part: [http://www.sapdesignguild.org/resources/htmlb_guidance/dropdown_dev.html|http://www.sapdesignguild.org/resources/htmlb_guidance/dropdown_dev.html] that it should support onClientSelect event - that should do it.
    Romano

  • Pages not loading completely with JavaScript enabled

    This just started in the last day or so. I have Safari extensions disabled.
    When I go to the ThinkProgress.org site/blog, I'm getting an incomplete page unless I disable JavaScript. With JavaScript, I'll get the first post on the blog, but nothing else. With JavaScript off I get the site looking pretty much normal.
    I get a similar problem if I go to Economist.com and click to read one of the stories. In that case, I get the story's headline, but it cuts off before the text of the article, right after a link to Tweet the story. Again, disabling JavaScript allows the page to load correctly.
    I suspect some third-party service is providing a script, which broke in the last day or so, but nobody's paying attention because of the Holidays.
    The problem doesn't appear to effect Chrome. Safari was upgraded to 5.0.3 in November, but this problem is more recent than that.
    Has anyone else seen this?

    Hi Jonathan,
    Go to the Economist.com site.
    From your Safari menu bar click Safari / Preferences then select the Advanced tab. Select the box next to: Show Develop menu in menu bar.
    Now click Develop / Disable Runaway JavaScript Timer.
    See if that makes a difference.
    Otherwise, check Safari / Preferences - Extensions or try disabling Safari plugins, Safari / Preferences - Security.
    And delete the cookies associated with those url's in Safari / Preferences - Security. Show Cookies
    Carolyn

  • Remove Extended Features with JavaScript?

    A LITTLE HISTORY:
    At first I was manually trying to crop a PDF using the Document > Crop Pages option in Acrobat Pro.
    However, it told me that I could not crop the document because the document "restricts some features to allow for extended features in Acrobat Reader" and that I should Save a Copy in order to remove the restrcitions and be able to crop the document.
    That was fine and that did indeed work by saving a copy. And, I was then able to crop the document.
    However, now I have been given hundreds of these documents to crop and they all have this "extended features" thing enabled on them.
    I was going to write a JavaScript batch command to crop the files (which I have done for previous projects) but it wouldn't work (I assume because of the extended features).
    Then I tried writing a javaScript to saveAs all the documents with the asCopy option set to true.
    That did not seem to work either because when I then tried to crop one of the saveAs files, I got the same "extended features" error.
    QUESTION:
    Does anyone know how I can programmatically get around this problem? Can I disable "extended features" via JavaScript? Can I do some sort of save or exprto or something that will strip it out? Am I simply doing something wrong? Or, is it just not possible?
    Any assistance is greatly appreciated!
    Mark

    I haven't even gotten to the code part yet.
    Here is a word-for-word transcription of the error message:
    This document restricts some Acrobat features to allow for extended features in Acrobat Reader. To create a copy of the document that is not restricted (and has no extended features in Adobe Reader), click Save a Copy.
    This is an Adobe Acrobat dialog where I have a Save a Copy button and a Cancel button.
    This warning message appears when I manually try to crop the document by using the Document -> Crop Pages option from Adobe Acrobat.
    As I was originally asking:
    Does anyone know how I can programmatically get around this problem via JavaScript? Can  I disable "extended features" via JavaScript? Can I do some sort of  save or export or something that will strip it out?
    I have 320 documents I need to crop. I really don't want to have to manually Save a Copy for each document.
    Thank you very much!

  • Can I with Javascript force Chrome users to open a PDF with Acrobat

    I have built a document in InDesign and exported to an Interactive PDF. I originally had issues with acrobat highlighting interactive buttons with a blue box but was able to get around this with a couple simple JavaScript lines that disabled this feature then re-enabled on closing. You can view the thread with my resolution here:
    Button Highlight in Interactive PDF from InDesign CC
    Great but now I have another issue. If the user opens with Chrome and has not disabled "Chrome's" PDF viewer the above JavaScript is ignored or not functional. It there a way with JavaScript or some other method to force the PDF to be opened with Acrobat in Chrome?
    I Miss FLASH this project would have been 100 times easier with action script and consistent across browsers ... curse you Steve Jobs.

    You need to not just think about Chrome. There is
    - FireFox
    - Microsoft Reader (comes with Windows 8)
    - Preview (comes with Mac)
    - iPad native PDF viewe
    - Android native PDF viewer
    Anyone getting a computer or tablet today can read PDFs without getting Adobe Reader and you need to give them a pretty compelling reason for them to download Adobe Reader to do what (they believe that) they can already do. I think it's the death knell for PDF forms.

  • Change TextView value with Javascript

    Hello,
    I'm trying to find a way of changing the value of an HTMLB TextView on the client side with javascript.
    Do you know how to do that ? Cannot work it out...
    Many thanks
    Nicolas

    Hi,
    this can be a bit tricky, because you have to know, how to access the element. that means you need an unique id or an absolute position of the TextView-element
    if you can see, how to access the specific element in your client-pagesource, a possible javascript could be:
    document.getElementById("<id of element>").firstChild.nodeValue="My new Text"
    or access by name/count of the element:
    document.getElementsByName("<name of element>")[#position of occurance].firstChild.nodeValue="My new Text"
    kr, achim

  • Change "choiseListe" values with javascript

    Dear,
    Is it possible to change "choiseListe"  values  with javascript.
    Exemple il have a choseListe :
         Country //// Values
          USA            us
          France         fr
          Spain           sp
    When il click in a botton i whant to change this choceListe :
         Country //// Values
          Morocco           ma
         Portugal           pt
    Thanks

    Hi,
    Listboxes and dropdowns can be scripted against without too much difficulty.
    You would need something like this in the click event of the button:
    listbox1.rawValue = null; //clear previous choice
    listbox1.clearItems(); //clear the list items
    listbox1.addItem("Moocco", "ma"); //add new list items
    listbox1.additem("Portugal", "pt");
    Hope that helps,
    Niall

  • Create a disabled Select Option in javascript

    Hi
    By now, I want to create a SELECT object with disabled options by using javascript.
    I tried "selectObj.options[1].disabled = true", it can work in Netscape, but not in IE.
    Does anyone can help?
    Thanks
    Michael

    Just tried, but doesn't work to me. Here is the complete html source
    <html>
    <head>
    <title>Test</title>
    </head>
    <script>
    function check()
         var selectObj = document.createElement("SELECT");
         selectObj.options[0]     = new Option("abc",1);
         selectObj.options[1]     = new Option("def",2);
         selectObj.options[1].id     = "def_id";
         var d = document.getElementById("test");
         d.appendChild(selectObj);
         var opt = document.getElementById("def_id");
         alert(opt);
         opt.disabled = true;
    </script>
    <body>
    <div id="test" name="test"></div>
    check
    </body>
    </html>

  • How to show note window for a table cell with javascript?

    My goal is to do tihs with javascript. No server side handling.
    <af:table id="t1">
    <af:column id="c1">
    <af:outputText id="ot1">....
    <af:clientListner ....method="showPopup"/>
    </..>
    </..>
    </..>
    <af:popup id="p1">
    <af:noteWindow id=ot2>
    here to show the value of ot1
    </..>
    </..>
    function showPopup(e){
    var text=e.getSource().getValue();
    var popup=e.getSource().findComponent("::p1");
    now how to update the content of the notewindow??
    popup.show();
    }

    Hi,
    You could try with something like this.
                   <af:outputText value="outputText1" id="ot1" clientComponent="true">
                        <af:clientListener method="showPopup" type="mouseOver"/>
                    </af:outputText>
                    <af:popup childCreation="immediate" autoCancel="disabled" id="p1" clientComponent="true"
                              contentDelivery="immediate">               
                        <af:noteWindow id="nw1" clientComponent="true">
                            <af:outputText value="outputText2" id="ot2" clientComponent="true" />
                        </af:noteWindow>
                    </af:popup>
                    <af:resource type="javascript">
                        function showPopup(evt){
                            var ot1 = AdfPage.PAGE.findComponent("ot1");
                            var text=ot1.getValue();
                            var popup=AdfPage.PAGE.findComponent("p1");
                            var ot2=AdfPage.PAGE.findComponent("ot2");
                            ot2.setValue(text);
                            popup.show();
                    </af:resource>-Arun

  • Modify hbj:tableView with JavaScript

    Hi forum-team,
    does anyone know if it is possible to modify the contents of a hbj:tableView-Cell with JavaScript (e.g. modify the text within a cell)?
    I only found some getClickedRow methods within the JavaScript API.
    Regards,
    Frank

    Hi,
      I can't get a code for this but can guide you.
    There is onClientCellClick event for tableview which can be used for this. You will have to implement separate methods for each cell click, I hope. Also this is a classlib and not taglib. Check the documentation for more info on this.
    http://help.sap.com/saphelp_nw70/helpdata/en/fd/01f34026d70b06e10000000a155106/frameset.htm
    Also check these.
    onClientRowSelection for tableView's
    onClientCellClick in htmlb tableview
    Regards,
    Harini S

  • Open and Close Popup With Javascript

    Using Apex 3.2
    I have probably done this loads of times in my old job, but do not have access to the code and today I just can't get it to work properly.
    I have opened a pop up window with javascript
    Now I need to close it and refresh the calling page, but only if it passes the validation on the popup.
    I have a hidden item on my pop up called P7_FLAG.
    I have a page process after validation that sets P7_FLAG to (only set to 1, if passes validation).
    I also have a SUBMIT button.
    So once I click my SUBMIT button the page should look at the validations, if ok, set P7_FLAG to 1, then close the popup and refresh the calling page.
    My current javascript look like this
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>On my button
    javascript:saveChanges();The problem is that I need to click the SUBMIT button twice.
    First time it sets P7_FLAG
    Second time it closes page and refreshes.
    I have probably made some basic error, but today I cannot see it.
    Cheers
    Gus
    Edited by: Gus C on May 10, 2012 12:48 AM

    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>javascript does not wait for the current action to complete and then perform the next line.
    means in your function call
    doSubmit('SUBMIT');is triggered and it carry on's to next line that is
    $x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
    what you need to do is amend your js function like below
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    </script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
    and set the branch source to below
    htp.p('window.close();');
    htp.p('window.opener.doSubmit(''REFRESH'');');

  • Links that open a new window with javascript:void(null); do not work in 3.1

    I've been noticing that any site I go to that opens content in a new window with "javascript:void(null);" will be ignored by Safari 3.1. The links work in Firefox and used to work in Safari as well. Any suggestions?

    General rule of thumb in the Mac universe...
    When Safari is updated most if not all third party add-ons break. That's because most don't play by the rules. The developer thinks they know how to do it better than Apple so they just do it their way. So the first rule of survival is to KNOW what you have installed on your machine at all times. Use something like textedit to create a document listing all of the third party stuff you have installed and religiously update the list. Second rule is to wait a few days before applying an update. Third rule is to visit your third party developers' sites and make sure their little gadget is compatible with the new Safari update.
    Being aware of things will make life much easier for you in the long run.

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

Maybe you are looking for

  • Can you help me with Firefox v7.0.1?

    Since your latest version of Firefox came out, it has been working like a charm. My problems started on Oct. 23, 2011 when I found I could not delete my e-mails, close tabs or serf the web. I can use my bookmarks and get in and out of Firefox but tha

  • Are Photoshop's 3D features available with the Single-app subscription?

    Hello, I'm a bit confused about how I get the equivalent of "Photoshop Extended" in the subscription world. I've had the PS subscription for a while but I don't think any of the 3D features were included. Now I need to get started with matte painting

  • Commitment carry forward

    hi gurus we just entered a new fiscal year and when we try to change orders created in the old fiscal year we get an error saying "Old FM line items 0010124941/00001 could not be found'. please advice.

  • Combining result set of two services into one result set

    Hi, I have a model where I am getting one result set (6 Fields) from BI query and another result set (3 Fields which gives real time values) from OLTP system. I want to show the output of these two result sets into single result set (7 Fields). I hav

  • Image-map hotspot coordinates as variables ?

    I am looking to develop an application that will allow operators to interactively define hotspots (clickable zones) on an image. Once done, this image map will be made available to a Web application, for user interaction (each click will be registere