Skip to Content
author's profile photo Former Member
Former Member

Javascript in AbstractPortalContent

Hi all,

I have a value in a javascript variable and I want to pass it in new java variable declared in the AbstractPortalContent.

It's possible ?

This is my code:

myPageContext.addRawText("<script language='JavaScript'>"+

"var array =window.opener.htmlb_formid'_htmlbElements';"

"var arr = window.opener[array];" +

"var comp = arr['id_component'];" +

"var valore = window.opener[comp].getValue();" +

"</script>");

String my_valore = valore;

Some can help me?

Thanks in advance

Stefano

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 25, 2005 at 05:08 PM

    Hi Stefano,

    I think I don't understand completely...

    You don't want to do it all at once within the same method, do you? (Because this doesn't make any sense for the JS part is evaluated at Client Side runtime, some ages after the Java method has been processed.)

    If you want to return this value to the AbstractPortalComponent later on, you could just pass it as a parameter and on Java Side read it from servlet request.

    Hope it helps

    Detlev

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Stefano,

      still I don't know your application cycle: you create the HTMLB/JS part and then - how do you come back to the server?

      If by a click on a link or so (so at least "manually"), just pass the value as a parameter to the link (by + "?name=" + value).

      If you return to server side by normal HTMLB events, you cannot pass the parameter this way. For this, you could create a hidden field and set the value by JS into this field and ask the field from server side by standard means.

      Hope it helps

      Detlev

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2005 at 02:31 PM

    Hi Stefano,

    I too have also found this issue. It is not possible to use the addRawText method to add this information. My requirement was to add in meta tags by using the addRawText method but after raising a support call with SAP they said it was not possible. However, we did find a way to add in css or javascript declaration by adding this information into the includes. Then you can use context.writeHeadIncludes() which then becomes part of the context.

    I hope this helps.

    Nick Mitchell

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Stefano,

      if you press the button, the event you use for opening the new window I expect to be the client side event? If yes, than you call your AbstractPortalComponent by URL, and then - just pass the parameter as a parameter!? Still having problems to realize the problem... hm...

      Hope it helps

      Detlev

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.