cancel
Showing results for 
Search instead for 
Did you mean: 

Re: insert JavaScript code into BHTML code

0 Kudos

Thank you!

I have a new problem.

I want to insert JavaScript code into BHTML code .

Is it real ?

For example:

<script language="JavaScript">

...

...

my_variable = "test";

...

...

document.forms[form_name].action = "`wgateurl(~OkCode="2100", ~zmy = my_variable)`";

document.forms[form_name].target = "_self";

document.forms[form_name].method = "POST";

document.forms[form_name].submit();

</script>

How me to solve a difficulty ?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I understand how do it.


document.forms["vhvin_filter"].action = "`wgateurl(~OkCode="2100")`" + "&~z_filter_vhvin=" + vhvin;

RESULT URL FOR ACTION:

.............URL...............&~OkCode=2100&~z_filter_vhvin=123

GET VALUE:

CALL FUNCTION 'ITS_GET_URL'
IMPORTING
url = zurl
EXCEPTIONS
its_not_available = 1
OTHERS = 2.
zvar = 'z_filter_vhvin'.
CALL FUNCTION 'ITS_PARSE_URL'
EXPORTING
url = zurl
var = zvar
IMPORTING
val = zvalue.

Former Member
0 Kudos

Hi Pavel,

your question i solve in this way:

1.)

<script type="text/javascript">

  function raiseEvent(object, value) {

          document.main_frm.elements['~okcode'].value = object;

          document.main_frm.submit();

       }

  function focus() {

        window.document.forms[0].elements[1].focus();   }

</script>

<form name="main_frm" enctype="multipart/form-data" method="post" action="`WGateURL(~target="_top")`">
  <input type="hidden" name="~okcode" value="">

Calling the link:

<a class="topnavi" href="javascript:raiseEvent('BASIC')"> `GS_T906-BTN.value`  </a>

2.)

if you have a table and you want to know in such line the link was clicked:

<script type="text/javascript">
   function raiseEvent(object, value) {

      document.main_frm.elements['~okcode'].value = object;
      document.main_frm.submit();
   }

   function focus() {
     var value;
        `if (GV_BSTPR_N.value == 1)`
             value = `GV_BSTPR_N.value`
        `else`
             value = `GV_BSTPR_N.value` + ( `GV_BSTPR_N.value` - 1 )
        `end`
        window.document.forms[0].elements[value].focus();   }
</script>

The link looks like

<a class="topnavi_m"  href="javascript:raiseEvent('`BSTPR_N-OKCODE[j].value`')">

In ERP i concatenate the OKCODE with table index, so i find every time my edit line.

my this will help you later.

Best regards

Thorsten

Answers (0)