Javascript access to htmlb textEdit

Hi,
Since the htmlb object textEdit does not support javascript access through the jsObjectNeeded option I tried another approach.
This approach is mentioned several times on SDN but it does not perform as excepted.
<% String compID = null; %>
<hbj:textEdit
id="reaction"
     text=""
     wrapping="SOFT"
     rows="5"
     cols="50">
     <%compID = myContext.getParamIdForComponent(reaction);%>
</hbj:textEdit>
<%=compID%>               (<-- test to write ID to html page)
This code retrieves the ID of the htmlb component. It works fine as I can write the htmlb ID to the html page.
However I need this ID in my javascript during a validation. The problem is that the ID is empty in the javascript.
Please help.
Raymond

Hi Raymond,
Try out the following piece of code (the code is tested and is working):
<hbj:textEdit      id="addComments"
                    wrapping="SOFT"
                    text=""
                    rows="2"
                   cols="100" >
     <% addComments.setJsObjectNeeded(true); %>
</hbj:textEdit>
Then through javascript you can access the id of the text edit in the similar fashion.
var txtAdCom= eval(func("addComments"));
var value =txtAdCom.getValue();
var length = txtAdCom.getValue().length;
Please do reward with points if the solution is helpful.
Thanks
Ritushree

Similar Messages

  • How to make Javascript access standard JSF component

    Hello all,
    I'm in need of a proper javascript code that access standard jsf component.
    Like we do for html tags;
    if( el.tagName.toLowerCase() != 'select')
    I need to do the same thing for a jsf tag i.e; <h:selectOneMenu>. How to make javascript access <h:selectOneMenu> like it does with <select> tag ? Please let me know asap. Extremely sorry if the question is kind of stupid....cause I'm a beginner for JSF environment.
    Any sort of help, suggestion or advice would highly be appreciated.
    Thanks in advance.

    Ummmm, I may be off the beaten path, but by the time your javascript is called the h:selectOneMenu would be a select tag within the dom. You should be able to reference that tag as you normally would.

  • Copy & Paste Data to htmlb:textEdit

    Hi,
    when I Copy & Paste Data from MS Office to <htmlb:textEdit> the following occurs:
    1) In the <htmlb:textEdit> note, the content is displayed without formatting. (OK)
    2) Saved content is displayed without formatting in the backend. (OK)
    3) Printing the content via SmartForms/Adobe pdf, #-signs are appearing. For example, spaces created with the tab key are displayed as ###.  (PROBLEM!)
    Are there anybody who knows how I can solve this problem. Basically, I just want to print what I see in my web application.
    I suspect that the <htmlb:textEdit> control is not completely removing all formatting from MS Office.
    What do you think?
    Any help is greatly appreciated.
    /Elvez

    Hi Elvez,
    I experienced, that the textedit uses '##' to identify a carriage return. We simply remove the placeholder, if we have to use the value of a textedit in other contexts.
    I don't think that it is related to the copy from MS Office, since the textedit takes erverything as plain text.
    Regards

  • How to store contexts of HTMLB TextEdit in R/3

    Hi,
    I've searched everywhere for examples on this and found nothing.
    Has anybody managed to store contexts of HTMLB TextEdit in R/3 and retrieve them into a TextEdit ?
    As Eddy just taught me, 10 points to the best answer
    Milan.

    Hi Thomas,
    the function you suggested did the job thank you and top points awarded .
    I was then able to pass the internal table containing the text to the SAVE_TEXT function and store the text in R/3.
    Using the READ_TEXT function I can now retrieve the text for viewing, which leads to my next problem...
    In a textView I am able add some abap scripting to enable the textView to display the text contents of an internal table.
    But I want to display the text in a textEdit set to disabled, the problem is I cannot get the textEdit to accept displaying text as the result of some abap scripting.
    For example, in a textView this works...
    <htmlb:textView encode   = "TRUE"
                   wrapping = "TRUE"
                   design   = "EMPHASIZED"
                   layout   = "PARAGRAPH" >
                   <%  do ltext_nlines2 times. %>
                   <%  read table ltext2 index sy-index into ltext_line2. %>
                   <%= ltext_line2 %>
                   <%  enddo. %>
                </htmlb:textView>
    but the same is not possible in a (disabled) textEdit for example...
    <htmlb:textEdit id   = "shortDescription"
                       disabled  = "true" >
                   <%  do ltext_nlines2 times. %>
                   <%  read table ltext2 index sy-index into ltext_line2. %>
                   <%= ltext_line2 %>
                   <%  enddo. %>
                 </htmlb:textEdit>
    does anyone know if it is possible to run some abap script in a textEdit to display the contents of an internal table ?
    Thanks,
    Tomas.

  • Limit length of htmlb:textEdit

    <htmlb:textEdit
         id="Edit_Text"
         text="Text to change - or just add text"
         wrapping="SOFT"
         rows="10"
         cols="30"
      />
    Specify Wrapping = "SOFT" in your textedit tags....

    Thanks for your answer.
    I found the problem.
    In fact my textEdit is encapsulated in a html:group / html:groupbody.
    If I put width = 100% to the group and width = 100% to the textEdit, the problem occurs.
    If I put only a width to the group, there is no problem.
    Thanks
    Regards.

  • JAVASCRIPT:  Accessing the sessionbean - how ??? can it be done?

    Hi,
    I need to access the sessionBean from javawscript. I have trawled throughj all posts and have got no satisfactory code.
    Can this be done?
    I have tried for eg alert(#{sessionBean.firstName}) and get a syntax error, i assume due to # symbol. do i need to CDATA this request?
    Any help, much appreciated.
    Regards,
    LOTI

    Your problem is trying to access server side information from the client side, so that alert is never gonna work in that simple form. If you want javascript access to a sessionbean variable, that variable will have to be present in the final rendered page....meaning bring it into your page as either a visible or inviisble field and then using javascript to read that. Thats one solution?

  • Can JavaScript access JSP variable?

    Could we do this? Or, how could we have JavaScript access JSP variable?
    <%
    String fooBar = request.getParameter(......
    %>
    <script language="JavaScript">
    <!--
    if (fooBar  == ...) {
    -->
    </script>

    To access the variable in Javascript you'll have to
    write it out from the JSP. You'll need to do something
    like:
    <%
    String fooBar = request.getParameter(......
    %>
    <script language="JavaScript">
    <!--
    var fooBar = '<%=encodeQuotes(fooBar)%>';
    if (fooBar  == ...) {
    -->
    </script>You'll need to either make sure fooBar doesn't contain
    any quotes or write a function to replace each ' with
    \'.Thanks!
    That works perfectly, without encodeQuote() method in my current case.
    Thanks again. You ar a saviour.

  • Htmlb:textedit position in TD

    Hello,
    I have a little problem with a htmlb:textedit.
    I put a htmlb:textedit  in a TABLE but I can't align it on the bottom of the cell. The textedit is always on the top.
    <%---- col 1----
    %>
    <%---- col 2----
    %>
    <%---- col 3----
    %>
    Thanks a lot for your precious help.
    Véronique

    Hi,
      Inside your BSP application use below code (example) for alignment..
       <htmlb:gridLayout rowSize   = "1"
                              columnSize  = "2"
                              cellSpacing  = "5" >
              <htmlb:gridLayoutCell rowIndex    = "1"
                                    columnIndex         = "1"
                                    horizontalAlignment = "left" >
        <---  your codes  --- >
           </htmlb:gridLayoutCell>
      </htmlb:gridLayout>
    Here,
    rowSize - Use this attribute to determine the number of rows.
    columnSize - Use this attribute to determine the number of columns
    If you get more information about gridlayout, refer the SBSPEXT_HTMLB BSP Application ->GridLayout.bsp
    Thnx
    Suriya

  • Access to HTMLB with JavaScript in DynPage class

    Hi, in the documentation JavaScript API of SAP HTMLB Guidelines there is an example code in 4 parts.
    1.
    Form form = (Form)this.getForm();
    nputField inf2 = new InputField("currencyDisplay");
    inf2.setJsObjectNeeded(true);
    inf2.setClientEvent(EventTrigger.ON_CHANGE, "calculateCurrencyToFrom()");
    inf2.setBCD("100");
    inf2.setWidth("250px");
    form.addComponent(inf2);
    2.
    function calculateCurrencyFromTo() {
    var funcName = htmlb_formid+"_getHtmlbElementId";
    func = window[funcName];
    var inputfield = eval(func("currencyDisplay"));
    if (inputfield)
    inputfield.setValue("100.23"); }
    3.
    InputField inf2 = new InputField("currencyDisplay");
    String inputfieldID = pageContext.getParamIdForComponent(inf2);
    4.
    <script> var inputfield = eval(inputfieldID);</script>
    I try to run this code in DynPage class. I put the code part 1 in doBeforeProcess(), then use form.addRawText() to send JavaScript code to client.
    <script> var inputfield = eval(inputfieldID);
    function calculateCurrencyFromTo(){
    var funcName = htmlb_formid+"_getHtmlbElementId";
    func = window[funcName];
    var inputfield = eval(func("currencyDisplay"));
    if (inputfield)
    inputfield.setValue("100.23");}
    </script>
    question:
    Where to put the part 3 in order to detect the input field is selected or triger the event? Thank you for help.
    Yantong Wang

    Hi Raymond,
    Try out the following piece of code (the code is tested and is working):
    <hbj:textEdit      id="addComments"
                        wrapping="SOFT"
                        text=""
                        rows="2"
                       cols="100" >
         <% addComments.setJsObjectNeeded(true); %>
    </hbj:textEdit>
    Then through javascript you can access the id of the text edit in the similar fashion.
    var txtAdCom= eval(func("addComments"));
    var value =txtAdCom.getValue();
    var length = txtAdCom.getValue().length;
    Please do reward with points if the solution is helpful.
    Thanks
    Ritushree

  • Accessing one htmlb tag by another

    How can I access one tag by another.
    So once the user selects an option from a dropdownlist, javascript gets executed that stores what the user has selected into a hidden inputfield.
    I need another dropdownlist to be able to read what has been written into that inputfield. Is there a way I can access the inputfield from the second dropdownlist tag ?
    Thanks

    There are a couple of methods that will enable you to do this: -
    1) (possibly the simplest) Have the input field as standard HTML tag as you can have both HTMLb elements and normal HTML in a JSP page. Then you can reference the element by using the standard document.getElementById('<tagid>').value
    2) (Slightly more complex)
       Have this type of thing at the top of the JSP page "<%String inputId = null;%>". This is the variable that will store the ID of the inputfield (or any other HTMLb element).
       Then, to set this field to the value required
       <hbj:inputField
        id="myfield"
        text="Click Here"
        tooltip="Click Here"
        disabled="false"
       >               
       <%inputId = myContext.getParamIdForComponent(myfield);%>
       </hbj:inputField>
       Then, you should have some javascript like this
    alert(document.getElementById('<%=inputId%>').value);
       Please note that this Javascript normally has to be after the set up of the innput field so that the inputId field is filled in before the javascript is executed
    I hope this helps
    D

  • Javascript access to images in a PDF

    Hello,
    i'm a newbie to javascripting adobe apps, so i hope you'll excuse me if the question is just too stupid...
    I need to open in photoshop all the images in a pdf document. The pdf doc is singlepaged, usually with a single image (it's a adverting page in a magazine). When I have to do a quick retouch on a image, i choose Touchup Object, select the image, right click and choose Modify Image (actually I am using Acrobat in Italian: i hope the traslation makes sense) and Photoshop pops up. I modify the image and save it.
    Is it possible to script this process?
    My basic question actually is: how do i have access to the image in the pdf document? Exploring the contents of the pdf I see the image is in a XObject: can i get to it via javascript?
    any help is really appreciated! thanks
    Mauroo

    What you're trying to do requires a plug-in written in C/C++.  It cannot be accomplished with Acrobat JavaScript.

  • Javascript Access Denied in WebDynpro Application SP11

    Hi all,
    I'm developing a WebDynpro application that is published in EP as a WebDynpro IView.
    Deploying the application and running as standalone (out of EP) this works fine but when I access that by EP I get JavaScript errors in DropDowns.
    I know that this error is know as an bug of SP11 but I want to know if someone obtain some answer from SAP or do anything to solve this problem.
    I already install another server with EP and WEBAS from the last SAP WEBAS installer downloaded from SAP website but the problem already persists.
    Server: WEBAS 6.40 SP11
    IDE: Version: 2.0.11
    Build id: 200503080124
    Thanks,
    Manoel

    Hi
      Refer to OSS Note no : 779659. But even in that case if you are using your own themes there are some display problems in SP11.
    In SP10 we had our own theme and we followed the OSS Note. It worked fine. When we applied the Same theme to SP11 it did not work.
    There is also another note which says that custom themes are not supported properly. I will try to give you the note number. Maybe that is a problem.
    I would advice you to try and use standard themes for your Webdynpro apps. Even if you apply the note you are not going to get proper display in case of SP11. Maybe the problem gets solved in SP12.
    regards
    ravi

  • Flash/Javascript access of USER Variables

    Hi all,
    I've searched online many many times and have made many attempts in Flash and in Captivate 4, but to no avail, and I'm wracking my brain over it. By now I've almost given up on Captivate, since what has wasted so much time could have been done in a day or so using Flash to make the entire thing. I would like to avoid that though, since this is a University project, not a personal project.
    I need to access USER created variables, both in Flash animations AND in Javascript (i.e. in the execute Javascript field under multiple actions). They need to be accessed this way since there's no default way to multiply variables or append strings of text to variables (things which as an experienced AS2 user I know should be very simple to do). Also, I want to be able to copy the contents of one (user) variable to another (system) variable later on (for LMS).
    So say I have a user defined Captivate variable called 'userPath', and on a certain slide I want to multiply it by 5 in Flash or in Javascript (just an example).
    How could I access it from Flash with AS2? (I've tried _root.userPath, _root.movie.userPath, no luck).
    How could I access it from the Javascript? (I am comfortable with programming, but don't really use Javascript, so I may be having a problem with the notation).
    Any help would be greatly appreciated, since I need to get this work done soon. Many thanks.

    Lboro SB,
    How familliar are you with AS3?  I would recommend altering the CaptivateMaintimeline.as file typically located at C:\Program Files\Adobe\Adobe Captivate 4\ActionScript 3.0.  You can write your custom functions in AS3 to do your multiplication or whatever and it will use this file to compile your Cp4 project.  Just make sure you're publishing your Cp4 project in AS3 in the project properties.  You could also add your function to the list of ExternalInterface.addCallback(... so that your function could be accessible from JavaScript.  Here's my custom function I've put in the CaptivateMaintimeline.as file:
    /JBL: For External Interface setting any type of value
            public function jim_cpSetValue(variable:String, val):void
            //myTrace("cpSetValue variable1 " + variable + " ; val  " + val);
            var arr:Array = variable.split(".");
            var ref = this;
            for(var i=0; i < arr.length -1; i++)
                ref = ref[arr[i]];
            ref[ arr[arr.length -1] ] = val; // This works fine for numbers, booleans and strings
    // JBL: adding callback to set variables in cp via JavaScript
    ExternalInterface.addCallback("jim_cpSetValue", jim_cpSetValue);
    If you want to do this in JavaScript, you need to get a reference to the Captivate main movie.  I do it like so:
        // Set objCaptivate in IE
        CaptivateObj = document.Captivate;
    Then you can call your custom function
        //JBL:  Custom Function to set Captivate Vars via Javascript
        function setCaptivateVariable(myVariable, myValue)
            CaptivateObj.jim_cpSetValue(myVariable, myValue);
        //JBL:  Shortcut function for Getting values from Captivate SWF
        function getCaptivateUserVariable(n)
            return CaptivateObj.cpGetValue(n);
    I also HIGHLY recommend a lightweight .js file by Philip Hutchison that can do much more located here.
    Good Luck,
    Jim Leichliter

  • html-el and javascript access

    Hi, I suppose this is a bit of a newbie question but I'm trying to fix a bug on code I've inherited. Basically the <html-el> tag defines the following and works fine
    <html-el:form action="saveConsumer" styleId="consumerForm" disabled="${consumerForm.formDisabled == 'true'}">
    However, there are a couple of fields on the form that call a javascript function to independently enable/disable the fields depending on which user is logged in, so I'm trying to access the value of the consumerForm.formDisabled boolean within javascript but can't seem to do so, I've tried whats below but it won't work - any help would be much appreciated!
    Thanks.
    Ray.
    <script type="text/javascript">
         function connectionPolicyToggle() {
              var element = document.getElementById('connectionPolicy');
              if (element.value == 'ALWAYS') {
                   document.getElementById('connectionThreshold').disabled='true';
                   document.getElementById('connectionFrequency').disabled='true';
              } else {
                   document.getElementById('connectionThreshold').disabled='document.consumerForm.formDisabled.value';
                   document.getElementById('connectionFrequency').disabled='document.consumerForm.formDisabled.value';
         }

    Thanks for that
    Just in case anyone else needs a simple version:
    var SlideNumber = 4;
    if(typeof window.cp === 'undefined'){
        if(SlideNumber != '') {
    document.getElementById('Captivate').cpEISetValue('m_VarHandle.cpCmndGotoSlideAndResume', SlideNumber  -1);
    }else
        if(SlideNumber != '') {
                window.cpCmndGotoSlideAndResume = SlideNumber-1;
    Thanks
    Luke

  • Javascript check on HTMLB radiobutton in radiobutton group

    Hi
    I want to check which radio button in my htmlb radio buttongroup is selected.
    I have tried to
    alert(eval(func("myButtonGroup"+htmlb_radiobuttonmodifier.substring(3,7)+"1")));
    but alert only shows 'undefined'.
    Is there any way to actually check what exactly I must inside "" in eval(func(""))?
    thanks in advance
    Anton Kruse

    Hi,
    First call a javascript function on selection of a radio button and inside that function write the following code.
    <script language="javascript">
      function checkRadio() {
       var funcName = htmlb_formid+"_getHtmlbElementId";
       func = window[funcName];
    //you have to use the name of radio group
       var rb1 = eval(func("myButtonGroup" +
    htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
        alert(rb1.getValue());
        alert(rb1.getChecked());
    </script>
    Regards,
    Tamil K

Maybe you are looking for

  • How to create Updateable Interactive report in APEX 3.2.1.00.11

    I have an interactive report and am asked to add few more user defined columns, some of them should be free text input box type and couple of others are dropdown list (with Y/N options). I can do that if that was just a SQL report but with interactiv

  • Regarding change pointers for HRMD_A

    Hi Abapers, I need to distribute changes to HR master data to a middleware system. hence i have activated the change pointers for the message type: HRMD_A. now my idoc is populating the infotype segments whenever it is changed with all fields. But a

  • Using JQuery deferred objects with JSOM

    Hi, I have written following query to execute a JSOM call using Jquery Deferred objects. But It is not working. I am getting following error: Uncaught TypeError: Cannot read property 'get_current' of undefined .  Can anyone help what is wrong here? <

  • [Invalid] Markup Validation - Understanding How-to Fix

    Hi, it's me again! I am finally now getting started on the W3 validator portion of the web site making process. I put my website through it and it listed these issues below: http://validator.w3.org/check?uri=http%3A%2F%2Frestorationacpc.com%2F&charse

  • BufferedImage memory issue.

    Hi! I'm writing an application that is basically an image filter: It takes a low-resolution input image and converts the grayscale value of each pixel into a font size. The font size is then used to render characters from a text file onto correspondi