Controll HTMLB:Checkbox via JavaScript

Hi all,
I`ve created a BSP application containing HTMLB:Checkbox components.
In this example the checkboxes are organized as a three of 2 levels.
When clicking/checking the parent checkbox, I want the rest of the checkboxes (children) to change status depending on their parent's status. e.g checked=true/false and disabled=true/false. The checkboxes become disabled/enabled, but you cannot see any change in their checked/unchecked status.
Though this works fine with design="classic", it doesn't when using design="design2003"...
I have to use design2003 in my application, and want to use HTMLB:Checkbox instead of regular HTML Checkbox- which also works.
The javascript syntax follows:
(it's from a loop containing all the children checkboxes)
nodeEl = elements<i>;
nodeEl.checked = true/false;
nodeEl.disabled = false/false;
I would have appreciated any kind of help.
Ogert

This is my intire code, Raja T. The Javascript works fine with regular HTML Checkbox, or HTMLB:Checkbox combined with classic design.
**HTML CODE
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<%<htmlb:content design="classic">%>
<htmlb:content design="design2003">
  <htmlb:document>
  <htmlb:documentHead>
  <script language='javascript' src='control_checkbox.js'></script>
  </htmlb:documentHead>
    <htmlb:form>
<table width="309" border="1">
  <tr>
    <td width="299" bgcolor="#999999">
    <htmlb:checkbox id        = "E1"
                    text      = "Parent"
                    checked   = "true"
                    onClientClick = "check_chkbox('E1');"/>
    </td>
  </tr>
  <tr>
    <td><htmlb:checkbox id        = "00111820|Chk0102|E1"
                    text      = "Child 1.1.1.2"/>
    </td>
  </tr>
  <tr>
    <td><htmlb:checkbox id        = "00111820|Chk0103|E1"
                    text      = "Child 1.1.1.3"/>
    </td>
  </tr>
    </htmlb:form>
  </htmlb:document>
</htmlb:content>
**Javascript Code:
var forms;
var elements;
function check_chkbox(id) {
  var el;
  var nodeEl;
  var splitname;
  var ind = 2;
  var name = id;
  var tempname = split_name(id,'',ind);
  if(tempname != '') {
    ind = 1;
    name = tempname;
  getCheckBoxes();
  el = document.getElementById(id);
  if(!eval(el.checked)) {
    for(i = 0; i < elements.length; i++) {
      splitname = split_name(elements<i>.id,name,ind);
      if(splitname != '') {
        if(elements<i>.id != id && name == splitname) {
          nodeEl = elements<i>;
          nodeEl.checked = false;
          nodeEl.disabled = true;
  else {
    for(i = 0; i < elements.length; i++) {
      splitname = split_name(elements<i>.id,name,ind);
      if(splitname != '') {
        if(elements<i>.id != id && name == splitname) {
          nodeEl = elements<i>;
          nodeEl.checked = true;
          nodeEl.disabled = false;
function split_name(name,splitname,ind) {
  var split_array = name.split("|");
  var size = split_array.length;
  var string;
  if(size == 3) {
    if(splitname != '') {
      string = split_array[ind];
      array = string.split(splitname);
      if(array[0] == '') {
        return splitname;
    string = split_array[1];
    return string;
  return '';
function getCheckBoxes() {
  var tempArray = new Array();
  if(elements == null) {
    tempArray = document.all;
<%--    case Firefox, Netscape --%>
    if(tempArray == null) {
      forms = document.forms;
      tempArray = forms[0];
    elements = new Array();
    for(i = 0; i < tempArray.length; i++) {
      if(tempArray<i>.getAttribute("type") == "checkbox") {
        elements[elements.length] = tempArray<i>;

Similar Messages

  • Can I control an Applet via JavaScript?????????????

    Please Guys! Can I control an applet via JavaScript?
    How????????????
    Thanks
    Renato

    Great to see you back, bbritta! Problems with the
    reauthentication stuff?The reauthentication was just another annoyance. I was getting fed up with answering posts for a variety of reasons (mostly because I don't have the patience you seem to have).
    I got assigned to modify some old ColdFusion code. I thought it would be a nice change of pace having never done it before. Yick... Gak... I should have started over with JSP's, but the user insisted they wanted the old code modified. I have never seen so much cut and paste coding in my life. They actually got hold of the old developer and he was so proud of his code that I didn't have the heart to tell him what I thought of his efforts.
    Anyway, a couple of weeks ago, I ran into a problem with an applet I wrote about a year ago and wanted to search the bug database. I reauthenticated fairly easily, but found out nothing had changed.
    A couple of days ago, there was a post in advanced topics asking if the forums were any use. I saw Dana respond and I thought it might be a chance to discuss some of the problems I saw with the forum. I came back to see if there was any response, but it looks like there will never be any meaningful discussion between Sun & the members about the forums.
    I have tried for a couple of years to just post a link to a search page if the answer could be easily found by searching. It seemed like a better thing to do than just saying 'Do a search!' I'm not sure anybody gets it though.

  • Refresh HTMLB checkbox by JavaScript

    Hi all, I have two HTMLB checkboxes on the browser(IE6.0).
    I would like to selecte one of thses and set the other one
    checked or unchecked. I can get the checkbox's ID on the client side. I can display the boolean value if the checkbox is checked or unchecked. But I can not set the checkbox checked or unchecked and let it displayed. The Javascript code on client side is shown as below:
    // ckid - id of the target checkbox,
    // myContent - objct of PageContext
    // test() is triggered by one of the two chechboxes
    //String ck_id=myContext.getParamIdForComponent(ckid);     
    <script language="JavaScript">
    function test()
       var myval = document.getElementById('<%=ck_id%>');
       alert(myval.checked);
       myval.checked = true; 
    Any hint will be appreciated.
    Best regards.
    Wang

    Hi Dagfinn, thanks for reply. My code is as follows, the missing 'e' is my typing error,
    String s2 = "<script>"
    +"function toggle1(){"
    +"document.forms[\'myForm\'].checkbox1.checked=!document.forms[\'myForm\'].checkbox1.checked"
    +"}"
    + "function toggle2(){"
    +"document.forms[\'myForm\'].checkbox2.checked=!document.forms[\'myForm\'].checkbox2.checked"
    +"}"
    +"</script>"
    +"<body>"
    +"<form name=\"myForm\">"
    +"<INPUT TYPE=CHECKBOX NAME=\"checkbox1\" onClick=\"toggle2();\">Check me1</input>"
    +"<INPUT TYPE=CHECKBOX NAME=\"checkbox2\" onClick=\"toggle1();\">Check me2</input>"
    +"</form>"
    +"</body>";
    getForm().addRawText(s2);
    The error message happens to both of them when they are clicked.
    Thanks for reply.
    BR.
    Wang

  • Accessing HTMLB checkbox in javascript

    Hi,
    I have the following scenario:
    1) jsp "main.jsp" has a checkbox with id="chkBoxId"
    2) In this "main.jsp" at the end, there is a jsp include
       including another jsp "buttons.jsp" - which contains a
       SUBMIT button.
    3) On this SUBMIT button, I am calling a javascript
       function "check()" in the "onClientClick" attribute.
    4) In this "check()" function I want to access the
       checkBox (present in "main.jsp")
    Now when I try doing this using the following code in the check() function, it gives me a "Undefined is null or not an object".
    function check(chkBoxId) {
    var funcName = htmlb_formid+"_getHtmlbElementId";
    func = window[funcName];
    var chkBox1 = eval(func(chkBoxId));
    // The checkbox is obtained
    if (chkBox1)
      alert("Not Checked");
    Plzz help me !!!
    regards,
    Jitendra

    HI,
    U can write the javascript function in the header tag or create a .js file in which u write the javascript code.
    the javascript code can be like
    function ValidateForm()
    if(document.form1.s_material.value=="")
    alert("enter material");
    return false;
    return true;
    where form1 is id of form and s_material is iD of input field.
    In your coding for button onClientClick like :
    <htmlb:button  id="s_but_submit"
                                       width="20"
                                       onClick="submit"
                                       onClientClick="if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"
    Regards,
    Siddhartha

  • Controlling Browser Elements via JavaScript or ActionScript

    From within one Flash movie, I'd like to open another browser
    window containing a different Flash movie. The movie opens just
    fine, but I'd like to deactivate the menu bar, address bar, and
    toolbar.
    Questions:
    • Can I control/set these elements?
    • Should this be done with AS? With JavaScript?
    • I've heard that using JS to perform such a task is
    problematic in some browsers?
    Any help shedding light on these questions is greatly
    appreciated.
    Octothorpe

    I would suggest getting yourself a javascript primer if
    you're going to do any sort of web programming. I've found some
    free tutorials hosted by
    http://www.w3schools.com/
    really helps. Second, it looks like Dave's script is using a
    javascript function that's he's added to the page, it's not part of
    the standard javascript library. The real javascript command is
    window.open(params). There are many many examples on the web of how
    to do this given the right search. Just be aware that it's real
    easy to get confused on the quotes and parentheses required for any
    getURL command that calls javascript.

  • Controling the flv via javascript

    I am looking for some tutorials on how to change the flv
    being played in a flash video component using javascript.
    Anyone have an idea of some good reading?

    I am looking for some tutorials on how to change the flv
    being played in a flash video component using javascript.
    Anyone have an idea of some good reading?

  • Controling a Gallery With Javascript

    I would like to use a Boolean array to control the images in a gallery.  Each index in the array would correlate to a specific image, which would not appear in the gallery if array[i] == false, but the image would appear if array[i] == true.
    I could use some help with controlling the gallery.  Is there a way to do the following?
        Access a specific slide at an index via javascript.
        Get the number of slides in the gallery via javascript.
        Add/remove slides to/from the gallery via javascript.
        Set the image path for a given slide via javascript.
    It seemed to me like such information should be here:
    https://developer.apple.com/library/iad/documentation/iAdJS/Reference/iAP.Galler yViewClassRef/iAP/iAP.html#//apple_ref/doc/uid/TP40010655
    However, I think I must be missing something.  If anyone could point me in the right direction, I would appretiate it!
    Thanks,
    Robbie

    Hmmm....Did you double-click on the cell and drop in the image object or just lay it on top.  It's gotta be inside the cell so it's included in the serialization.  Not sure what else it could be.
    Code for the page that works for me is:
    this.milestones = [];
    this.onViewControllerViewWillAppear = function (event) {
              // Code here for the "View Will Appear" event.
        // path to my server
        var webservicePath = "http://localhost/myfeed.json";
        // asynchronously load the webservice
        var xmlLoader = new iAd.XHRLoader(webservicePath);
        xmlLoader.delegate = this;
        xmlLoader.load();
    // Called when the XHR call failed
    this.loaderDidFail = function ( loader, error ){
        alert("Load failed with error: " + error);
    // Called when the XHR call was successful
    this.loaderDidComplete = function (loader){
        var galleryView = this.outlets.timelineGalleryView;
        galleryView.dataSource = this;
        // grab and store the content returned
        var json = loader.content;   
        var jsonObj = JSON.parse(json);
        this.milestones = jsonObj.timeline.milestones;
        // store an archived copy of the prototype cell
        this.archivedPrototypeCell = iAd.Archiver.archive(galleryView.cellAtIndex(0));
        // tell the gallery to update itself
        galleryView.reloadData();
    this.cellAtIndexInContainer = function(container, index) {
        // create a new instance of the prototype cell
        var newView = iAd.Archiver.restoreFromArchive(this.archivedPrototypeCell);
        // event data at the index
        var milestone = this.milestones[index];
        // get the path to the event image
        var imagePath = milestone.image || '';
        // create an image object and assign to the image property of the imageView
        newView.subviews[3].image = iAd.Image.imageForURL(imagePath, false);
        // set the text values
        newView.subviews[0].text = milestone.date || '';
        newView.subviews[2].text = milestone.title || '';
        newView.subviews[4].text = milestone.description || '';
        return newView;
    this.numberOfCellsInContainer = function(container) {
        return this.milestones.length;
    and the cell hierarchy looks like this:
    -M

  • The status bar is blocking my content, is there a way to disable it via Javascript and the likes?

    I'm working on a site that requires a bottom footer in a fixed position, with a control button on the left hand side, my problem is, that the `new` status bar area covers this section for quite some time whilst it's requesting data, or waiting for the server, is there a way to disable it via JavaScript or some sort? It seems kind of silly for a status bar to cover your content (no offence), the old way was much nicer, sure it used more screen space, but atleast it didn't assume things. I just couldn't find a solution anywhere else, other than to move the button. :)

    You can use this extension to hide the pop-up that shows the URL of a link on hover and other data that previously appeared on the Status bar.
    *Status-4-Evar: https://addons.mozilla.org/en-US/firefox/addon/status-4-evar/
    Add code to userChrome.css below the @namespace line.
    *http://kb.mozillazine.org/userChrome.css
    *http://kb.mozillazine.org/Editing_configuration
    <br />
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #statusbar-display { display:none!important; }
    </nowiki></pre>

  • Resize an Object via javascript

    Resize an Object via javascript
    How do I...
    I want to select an object in my document, onscreen, (an image, or text) then run a script that will discern the object selected, and show a dialog box that will allow me to input a sizing percentage for that object (with anchor corner/center)(Press enter and object resizes).

    No they don't.
    Acrobat may be bundled with Creative Suite collections but the APIs has nothing in common other than the use of JavaScript. CS apps use the ExtendScript system, Acrobat has its own internal API and an SDK for inter-application control.
    PDF is an end-destination format - the page content is not designed to be edited, so while there are tools in the user interface to allow touchups and corrections to page objects those features are not available for automation. The JavaScript engine does not have access to the low-level document structure, it can only see markup (comments and form elements) and a limited range of document properties.
    bdmasha wrote:
    They are all part of a suite of tools that share a common access to internal api's via scripting/programming languages.
    InDesign is not Photoshop is not Illustrator, but they have much in common when accessing their api's that Acrobat does not allow--and Acrobat is part of that Adobe suite.
    Thanks again.

  • Clicking a htmlb:button via Java Script

    Hi all!
    I would like to 'click' a htmlb:button via Java Script.
    Example with a html-button:
    <htmlb:button id="b1" onClientClick="javascript:document.form_id['b2'].click()" text="Call Button 2"/>
    <input id="b2" type="button" onclick="alert('2')">
    Does anybody have an idea how it works with a htmlb:button?
    Thanks!
    Stefan
    Message was edited by: Stefan Kittsteiner

    Hi Stefan,
    Use this
    <script>
    function submit()
      return htmlbSL(this,2,'b2:b2Click');
    </script>
    <htmlb:button id="b1" onClientClick="javascript:submit()" text="Call Button 2" />
    <htmlb:button id="b2" onClientClick="alert('I am clicked')" text="Button 2" />
    b2Click is server event for button 'b2'.
    You can also use <bsp:htmlbEvent> for more details see weblog  <a href="/people/brian.mckellar/blog/2004/07/18/bsp-in-depth-using-the-htmlb-event-system In-Depth: Using the HTMLB Event System</a>
    Regards,
    Narinder Hartala

  • How to Controll Dynamic Checkbox Groups

    i want to create checkbox groups dynamically. Each group will have at least one child checkbox. if i select parent check box all child checkboxes should be checked.if i uncheck parent checkbox all child checkboxes should be unchecked.
    that check box group name also coming dynamically. i am trying to pass group name dynamically but it's not recognizing that name in javascript.
    pls help me on this how to controll dynamic checkbox groups.

    recognizing that name in javascript.Are you dynamically creating checkboxes with JSP?

  • How to get elements in a multi-value field via javascript?

    The following will set variables.variable1 to variables.variable2 when the "Script Link" component is clicked...
    <Field>
    <Display class='Javascript'>
    <String>
    function myScript() {
    el=getElement(document.mainform,"variables.variable1");
    el2=getElement(document.mainform,"variables.variable2");
    el.value=el2.value;
    </String>
    </Display>
    </Field>
    <Field name='Script Link'>
    <Display class='Link'>
    <Property name='URL'>
    <String>javascript:myScript();submitCommand(document.mainform,%20'Recalculate');</String>
    </Property>
    </Display>
    </Field>
    My issue is, if variables.variabl2 is a list / multivalued, i get errors trying to traverse through the "array".
    How can i read and set an a list element via javascript function above? I've tried things like get() , and variables.variable2[0] .
    any help would be appreciated....
    is there an API somewhere i can reference?

    Hi,
    thanks for your reply!
    If I have the parameters in the URL and use the method GET it works all right.
    but I need the method to be POST. I suppose, I have the wrong way identifying the parameter name
    This is from VB
    varTarget = "http://localhost:9090/gm/getData" ' getData is my servlet
    xmlSendStr = "SQLStmt=SELECT TCPD_Cars.* From TCPD_Cars WHERE (((TCPD_Cars.CarIdent)=45));"
        xmlHttp.Open "POST", varTarget, True   'True means asynchronous
        xmlHttp.Send xmlSendStrthis is part of my Servlet
         protected void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter writer  = response.getWriter();
              String SQLStmt = request.getParameter("SQLStmt") ;
            //make the database query and get the returns
            writer.println(GetSQLData(SQLStmt));
            //close the write
            writer.close();                    
         }I would appreciate any suggestions

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • Open PDF in browser - but cant control/close window from javascript

    Hi
    I hope I picked the correct forum
    Basically I have a site in asp classic. From a button I opens 2
    windows via javascript.
    One contains info, one shows a related file ( could be tiff or pdf ).
    When user closes info-window, I also close the file window via javascript, so that user only hav to click once.
    That works with tiff, but not with pdf, '!file.closed' returns that window are already closed.
    Somehow I simply loose contact to that window when I open pdf.
    My Adobe is set  with "open pdf in browser", version 10.1.2
    Any Ideas ?
    Overview what I do:
    function openTwoWindows(jnr,vikar,hvorfra){
              var left, top,vikar;
              width = (window.screen.availWidth/2)+80;
              width2 = (window.screen.availWidth/2)-80;
              height  = (window.screen.availHeight);
              info = window.open('info.asp'','top=0,left=0,height='+height+',width='+width+',resizable=yes,scr ollbars=yes,status=yes');
              var settings= 'toolbar=no,location=no,directories=no,'+
              'status=no,menubar=no,scrollbars=no,resizable=yes, top=0, left='+width+', height='+height+',width='+width2;
              file = window.open('showfile.asp?strJnr='+jnr+'&print=false','file',settings);
              info.focus();
    function closeFileWindow(){
                if(file && !file.closed){
                             file.close();
    if the file is a pdf -> showfile code in asp classic:
    Response.AddHeader "Content-Disposition","inline;filename=filename.pdf"
    Response.ContentType = "Application/pdf"
    'Response.Clear
    Response.Buffer = true
    // fetch file from database
    Response.BinaryWrite rsTmp("Fil")
    Response.Flush
    Response.End

    Read this:
    http://forums.adobe.com/thread/535609?tstart=0

  • Firefox 3.6 crashes or hangs when setting an iframe src to a pdf via javascript. 3.5 works fine

    Firefox hangs or crashes when setting iframe src to a pdf via javascript. Works fine in all previous versions of Firefox. This is using the most recent version of Adobe Reader 9.
    == This happened ==
    Every time Firefox opened
    == I upgraded to Firefox 3.6

    More info:
    Seems to be the same issue as this
    [http://support.mozilla.com/en-US/forum/1/585926#threadId622326]
    and this
    [http://support.mozilla.com/en-US/forum/1/585926?forumId=1&comments_threshold=0&comments_parentId=585926&comments_offset=20&comments_per_page=20&thread_style=commentStyle_plain#threadId659555]

Maybe you are looking for