Passing Value to Java Script Code in a BSP

Hi Guys,
In order to use BSP Extension in my BS i need to specify the "ID" for the field / Text area / Table i want to work with.
Now these elements (Field / Text Area / Table) are created by SAP CRM automatically and i am not sure how i can get the name of the ID for such a element.
I tried using FIREBUG in firefox to get this ID but the problem is that this ID changes dynamicaly and i cant hardcode it in my BSP application.
Can anybody point help me taht how can i determine the ID dynamically at runtime and then use it in my BSP application.
Thanks in advance.

Hi,
       You can pass data from SAP to javascript in the following way. Suppose I have created an input field like
<thtmlb:inputField id      = "IF1"
                   type    = "string"
                   visible = "false"
                   value   = "//mynode/myattr" />
Note that I have bound the input field to a context node attribute. This is only necessary if you wish to access this field inside your controller methods.
Now, you can access this input field in your javascript in the following way. Inside the script, setting th evalue or reading, whatever,
document.all("<%= controller->component_id %>_IF1").value = "some text" ;
Regards,
Arun Prakash

Similar Messages

  • Pass value of Java script variable to ABAP variable (in BSP)

    Hi,
    I have a Javascript variable declared in the SCRIPT tag of BSP layout page.
    I want to pass its value to ABAP variable, so that later I can do some computations using the ABAP variable.
    (ABAP variable is also declared in the same SCRIPT tag of BSP page)
    Would request to post a sample code, if possible.
    Would appreciate quick replies.
    Thanks & Regards,
    Nisha Vengal.

    just check this
    https://forums.sdn.sap.com/click.jspa?searchID=16240444&messageID=1191305

  • Pass value in SAP Script

    How can u pass value in SAP Script?& where?

    Hi,
    PASSING TABLE VALUES AS AN ARGUMENT TO SAPSCRIPT:
    In the line editor, specify the table field arguments enclosed by '&' symbol as follows:
    /E  ELEMENT
         &KNA1-KUNNR& ,, &KNA1-NAME1& ,, &KNA1-LAND1&
    Save -> Activate.
    In the Print Program, specify following code:
    TABLES KNA1.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
       FORM                              = 'ZSHABFORM1'
       LANGUAGE                          = SY-LANGU.
    SELECT * FROM KNA1.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'ELEMENT'
       WINDOW                         = 'MAIN'.
    ENDSELECT.
    CALL FUNCTION 'CLOSE_FORM'.
    Save -> Activate -> Execute.
    Regards,
    Priya.

  • How to get/read region item value in java script

    Hi All,
    i have text item on a page.
    how to read the item value in java script
    EXAMPLE
    P10_RESULT IS ITEM IT HAS VALUE "38.956472,-77.447777","38.999123,-77.026184","12.951497,70.668646","17.459075,78.456888"
    NOW I WANT TO REFER ABOVE ITEM VALUE IN JAVA SCRIPT LIKE
    var myPoints=new Array(&P10_RESULT.);
    SO I CAN POPULATE ARRAY WITH CORDINATES
    IT IS NOT WORKING
    WHAT IS THAT I AM MISSING.
    PLESE HELP .
    ThankS
    Rk

    region header code....
    <script src="http://maps.google.com/maps?file=api&v=2&key=&API_KEY." type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    //globals
    var bounds = new GLatLngBounds();
    var map;
    var centerPoint = new GLatLng(38.984898,-76.854549);
    var gmarkers = [];
    //var x= ""38.956472,-77.447777","38.999123,-//77.026184","12.951497,70.668646","17.459075,78.456888"";
    //var myPoints=new Array(x);
    //var myPoints=new Array($x('P10_RESULT').value);
    var myPoints=new Array(document.getElementById('P10_RESULT').value);
    //var myPoints=new Array("38.956472,-77.447777","38.999123,-77.026184","12.951497,70.668646","17.459075,78.456888");
    function initMap()
              doLoad();
                        addMarkers();
    function doLoad()
         if (GBrowserIsCompatible())
                   map = new GMap2(document.getElementById("map"));
                   map.setCenter(centerPoint, 7);
                   map.addControl(new GScaleControl());
                   map.addControl(new GLargeMapControl());
                   map.addControl(new GMapTypeControl());
    function myclick(i) {
    GEvent.trigger(gmarkers, "click");
    function addMarkers() {
         if (myPoints.length) {
              var bounds = new GLatLngBounds();
              for (n=0 ; n < myPoints.length ; n++ ) {
                   var mData = myPoints[n].split(',');
                   var point = new GLatLng(mData[0],mData[1]);
                   bounds.extend(point);
                   var marker = createMarker(mData[1],point, mData[0]);
         map.addOverlay(marker);
              map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
    function createMarker(i,point, title) {
         var marker = new GMarker(point,{title:title});
         GEvent.addListener(marker, "click", function() {
              marker.openInfoWindowHtml('<div style="width:250px;">' + title + '<hr>Lat: ' + point.y + '<br>Lon: ' + point.x + '</div>');
         gmarkers[i] = marker;
         return marker;
    //]]>
    </script>
    page body code
    onload="initMap()" onunload="GUnload()"

  • Pass value from Java to Perl

    Anyone knows how to pass value from Java to Perl program?

    Did you write the perl program? Can you change it? Or are you trying to interface to something that already exists? This will limit your options, of course.
    Anyway the first option is simple. The java program does this:
    System.out.println("This is a line of input.");The perl program does this:
    while(<>)and in that block, $_ is assigned to each line of input.
    Then you can invoke both like this:
    $ java MyJavaProgram | perl MyPerlProgram.pl

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • Java Script Code not working properly for visios in sharepoint 2013

    Hi all ,
                 I have few visios and I am using the visio web part to display and to redirect from one visio to other visio I am using the java script code through content editor web part . 
    In share point 2010 it's working fine , I was able to redirect to all the visios and code is working fine .
    In share point 2013 its not the same , Its not working properly . only for the first time the code is working fine . once it goes to next visio the code stops working . 
    For example if i click in visio A it gets redirect to Visio B and its stops working , it wont allow to do any other steps . 
    I have checked with the URL its correct , I am not able to find any error also .
    Indresh

    This will be likely caused by the Minimal Download Strategy not registering the Javascript on the page reload. You can turn off the MDS feature to test this.
    You can either turn off MDS in your site, or register your Javascript functions with MDS to ensure they are called. To do this, you'll need all of your code to be wrapped in a javascript file (Embed this on the page using a <script> tag and
    inside that file in a function, which you then register with MDS as follows (I usually do this in the first line of the javascript file):-
    RegisterModuleInit("/SiteAssets/YourJavaScriptFile.js", NameOfYourFunction);
    Regards
    Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • How to Include JAVA script code in SAP BI7 web Reporting?

    How to Include JAVA script code in SAP BI7 web Reporting?

    In nw2004s there is a new web item called "Script" web item which lets you add javascript code. When you add javascript code in this web item, you don't need the opening and closing <script> tags...
    Hope it Helps
    Chetan
    @CP..

  • Java script code missing' comes up in a window when I try to batch process my images in photoshop.

    I have an imac version 10.9.4, Photoshop cs5.1. I'll select file-script-image processor and that is when the 'java script code missing' pops up. It used to work before I upgraded to the version 10.9.4. I called Apple and they don't know what to do. Now I'm here on the community site hoping someone can help. Not being computer savvy I don't understand anything I try to read about it.

    I finally found out that my 'McAfee SiteAdvisor' add-on was causing the problem for me. You can either disable it from your add-ons by clicking on tools, then add-ons and then disable it from your list of add-ons, or if you still wish to use it like I do, you can unistall it from your add-on list, and then download it from the official McAfee web site and then simply reinstall it... Since I've done this my firefox been loading faster, no annoying pop-up window when I launch or open a new tab. It was also crashing quiet often before I did this and that seemed to be fixed now.
    here is the link for the McAfee SiteAdvisor download from the official McAfee web site if anyone needs to download it again like I had to.
    http://us.mcafee.com/root/product.asp?productid=sa

  • Early 2008 mac pro 8 core quicktime videos opening in java script code

    When I try to view a quicktime video it opens in Java Script Code instead of playing the video on my early 2008 Dual Quad Core 2.8 Ghz. Mac Pro running OSX 10.5.8 

    That's not much to go on, but I doubt it has anything to do with it being a Mac Pro. Select the clip and Get Info (Cmd I) to see what application is named in the "Open with" drop down menu. If it is anything other than QuickTime player, change it and try again.  Also, repair your permissions...

  • Setting the XML tag value in Java script

    Hi,
       I am trying to set a XML tag value in the initialize event of a text field.. The code works fine in FormCalc but I needed it to work in java script.
         FormCalc:
         $record.prospectApplication.typeName = "namedInsured";
         Java Script:
         xfa.record.prospectApplication.typeName = "namedInsured";
         The above JavaScript does not work. Can any one help on this?
    Thanks
    Srini

    Hi Srini,
    In JavaScript you don't get any default properties so you need to say;
    xfa.record.prospectApplication.typeName.value = "namedInsured";
    That is assign the value to the "value" property not the dataValue object.

  • Round value in java script

    hi,
    I have to calculate Salary into textfield .
    Problem is after Calculation salary amount 1230.3566678787 like this come into text field.
    i want only 1230.35 amount.
    <script>
    function multiplyItems(){
    function getVal(item){
    if($x(item).value != "")
    return parseFloat($x(item).value);
    else
    return 0;
    $x('P65_SALARY').value =getVal('P65_ADVANCE_PAYMENT')+
    getVal('P65_OVR_TM_AMT')+getVal('P65_BONUS') + getVal('P65_OTHER_CHARGES')-getVal('P65_LEAVE_AMOUNT');
    </script>How can i do this in java script.

    Change your code as below.
    <script>
    function multiplyItems(){
    function getVal(item){
    if($x(item).value != "")
    return parseFloat($x(item).value);
    else
    return 0;
    $x('P65_SALARY').value =Math.round((getVal('P65_ADVANCE_PAYMENT')+getVal('P65_OVR_TM_AMT')+getVal('P65_BONUS') + getVal('P65_OTHER_CHARGES')-getVal('P65_LEAVE_AMOUNT'))*100)/100;
    </script>Better if you post a javascript question in a javascript forum. Chances of getting a solution will be increased.

  • How to write JSP code in Java Script Code

    Hello friends
    I have code like
    <script language="JavaScript">
    function f()
    (some code is here)
    </script>
    Now i wants to put some JSP code in f()
    So can i do this ? IF yes then how ?
    (one solution may be make JSP function and call that JSP function from the f().So in that case how can i call JSP function from JavaScript??
    If other method is there then please mail me

    If it's a simple matter of mixing client-side code with server side code, it can be done so long as you're using the server-side to write the client-side.
    For example:
    <h1>Good Morning Mr. Phelps</h1>
    <input name=anybodyFunction type=text>
    <% if (userIsAdmin) { %>
    <input name=adminOnlyFunction type=text>
    etc.
    <% } %>
    <h1>This browser will self-destruct in ...</h1>
    That's JSP (inside the <% %>) mixed with HTML.
    Javascript goes 100% on the client-side. If you're writing JSP with inter-mixed HTML, you might have to inter-mix the java-script.
    For example: Suppose you need to validate the form. "adminOnlyFunction", among others, is a mandatory field, and you want the Javascript to only submit the form if all mandatory fields are set. Well, if the user is NOT an administrator, then that field WILL be left blank.
    One way to handle that is with mixing JSP/HTML/Javascript on the SERVER side.
    <h1>Good Morning Mr. Phelps</h1>
    <input name=mandatory1 type=text>
    <input name=optional1 type=text>
    <% if (userIsAdmin) { %>
    <input name=adminOnlyFunction type=text>
    <% } %>
    <input name=submit type=button value=Submit onClick="checkit()">
    etc. etc.
    <script language=Javascript>
    function checkit() {
    var f = document.form;
    if (
    � � f.mandatory1.value == ""
    � � || f.mandatory1.value == ""
    � � || f.mandatory2.value == ""
    <% if (userIsAdmin) { %>
    � � || f.adminOnlyFunction.value == ""
    <% } %>
    � � � � ) {alert ("Hey! You left out a required field!!");}
    etc. etc. etc.
    I imagine THIS might be what is meant by "mixing JSP with Javascript", and in this particular fashion, it can be done. What you're doing is making decisions on the server side over what to write out to the client. That client code can make further decisions based on user input.
    However, once it's on the client side, you can not have anymore JSP code. The client NEVER runs JSP code.

  • Passing array to java script

    How can i pass an array to a java script function??

    <html>
    <head>
    <script>
    <%
    String[] myArray = new String[2];
    myArray[0] = "hello";
    myArray[1] = "hello again";
    %>
    function showArray(){
    <%
    for(int i = 0; i < myArray.length; i++){
    %>
    alert("<%= myArray[i] %>");
    <%
    }//end for
    %>
    }//end showArray
    </script>
    <body onLoad="showArray()">
    </body>
    </html>

  • Problem- Accessing java script code in java

    i want to access java script variable in java code.
    Is it possible through any method or function?
    help me.

    Stick to your old thread.
    http://forum.java.sun.com/thread.jspa?threadID=777985

Maybe you are looking for

  • How to use one Assign action to create multiple context variables

    Hello, everyone. I read some tips from Oracle documentation that said: Avoid creating many OSB context variables that are used just once within another XQuery Context variables created using an Assign action are converted to XmlBeans and then reverte

  • Automatic Send mail when sales order is change

    Hi friends, I have a requirement that  when ever sales order is created or change i.e in va01 or va02 automatically mail to send to customer. So please can u sujjest me in doing this ? with regards, prasad.

  • Network connection, which is better?

    I will be adding a MAC Pro Tower, dual quad 8, to my wireless network this week. At present, I have one wired connection and 3 wireless connection on my d-link n-protocol network. My question is this: Should I connect the MAC computer wirelessly or w

  • I want to print. 'selection' and' print frames' are greyed out.

    I want to print info on a page. 'selection' & 'print frames' are greyed out. == This happened == Every time Firefox opened == forever

  • Using "older" generic accessories with 3rd G nano

    I have discovered that even relatively new accessories such as FM transmitters for iPods (car) and speakers with a base, do not fit the new nano. Is anyone aware of any potential "danger" in using these accessories despite the fact that the adaptors