Skip to Content
author's profile photo
Former Member

Passing a ABAP View atribute into a javascript func as a parameter

Guys,

This must be really simple ,but I am missing something

I need to pass a view attribute lv_name into a javscript

function written in the view.

e.g

function do_something(name) {

}

My call looks line do_something(lv_name) on a onClientclick of a button.But that does not work.

Appreciate any input.

Thanks,

Manoj

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 04, 2005 at 07:04 AM

    Hi Manoj,

    the coding in the view should look like (no need for a hidden field):

    do_something(<%= lv_name %>);

    regards

    Thomas

    Message was edited by: Thomas Ritter

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hai,

      This is a sample where I am passing a variable to the javascript function that I am calling .

      [code] <xhtmlb:toolbarLink id = "TBAR_LINK_RESULT_PERS"

      text = "<%= otr($tmp/ipcb_rcn_personalize) %>"

      reference = "javascript:do_myjavascript( '<%= zcl_header=>mc_appl_name %>','TBL_RCN_HDR' );" />

      [/code]

      regards,

      Venkatesh.

  • author's profile photo
    Former Member
    Oct 04, 2005 at 04:00 AM

    hi,

    Add a hidden field in your view page and assign its

    value = "<%=name_of_page_attribute%>"

    where "name_of_page_attribute" is your page attribute.

    then access this attribute inside your javascript code

    using:

    var asd = document.form[0].hidden_field_name.value;

    now you will have the value of page attribute in variable asd.

    hope this helps you,

    Regards,

    Hemendra

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 04, 2005 at 09:25 PM

    Thanks everybody,

    this format : function do_something('<% =var %>')

    works fine.

    Add comment
    10|10000 characters needed characters exceeded