cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Java script in a web item

Former Member
0 Likes
528

Hi,

I need to attach a java script to a web item (text)! I believe that i need to create a script object with the necessary java script and then use this script object in text web item. But Im not sure how to do it. Plz let me know if you have any idea.

View Entire Topic
Former Member
0 Likes

Hi,

all you need is a script item. You have to drag it to your web application. In this script item you can implement your javascript function, which can be called in other parts of the html file.

Regards

Erwin

Former Member
0 Likes

Hi,

I defined my Script item with java script, but I dont know how to call into my Text web item!

Former Member
0 Likes

Hi,

you can try with: TEXT_ITEM_1_TextItem - "1" is for the first TEXT_ITEM, so if it is 2 TEXT_ITEM you should use: TEXT_ITEM_2_TextItem.

If it will not help, you can use for this purpose: firebug for firefox to investigate the generated name of the web item.

Regards

Erwin

Former Member
0 Likes

After we generate the script javascript, a Function will be generated and I believe we need to use this FUnction in calling the script into text web item. I follwed the below link to get the process, but Im not sure how to replicate the same with Text Web item.

http://help.sap.com/saphelp_nw70/helpdata/en/43/f5daaddfdb4c60e10000000a155369/frameset.htm

Former Member
0 Likes

Can you explain exactly what would you like to do with this Text field?

Erwin

Former Member
0 Likes

I have a java script code which will display some information after it gets executed. Now I need to use this java script code in a Text Web Item, so that I can show the script output as a webitem. After we run the report, I should see the javascript executed and displays the result in the text web item area.

Former Member
0 Likes

I have very similar scenario in my web application, but for this purpose I use INPUT_FIELD_ITEM and not TEXT_ITEM.

You can choose the value of your INPUT_FIELD_ITEM with the following javascript code:

document.getElementById('INPUT_FIELD_ITEM_1_input_inp').value = 'dddddd';

I hope that is helps

Erwin

Former Member
0 Likes

Edwin,

How can I pass Java Script to the document.getElementById('INPUT_FIELD_ITEM_1_input_inp').value =??

Former Member
0 Likes

you wrote the you "have a java script code which will display some information after it gets executed". You have your code propably in SCRIPT_ITEM, so all you have to do is to put this line inside your function.

your function:

function yourfunction()

{

your code...

at the end you get some result, which you would like to show in the input item

document.getElementById('INPUT_FIELD_ITEM_1_input_inp').value ='your result'

}

that is all

Regards

Erwin