cancel
Showing results for 
Search instead for 
Did you mean: 

passing data from calling page to popup window

former_member184111
Active Contributor
0 Kudos

Hi All,

We are developing a BSP application for business card.I need to provide a preview button .

when the user clicks this button a

poopup window should open with the preview of business card.

My problem is how to pass the values like name , designation etc from the main page to popup window.

The code for previre image:

<h t m l b : i m a g e   s r c = " s _ b _ d e  tl . g i f  " a l t = " P r e v i e w   C a r d "  o n C l i c k="addr" on C l i e n t C l i c k = " c a l l W i n d o w ( ) ; "/>

<s c r i p  t t y p e = " t e x t / j a v a s c r i p t ">
f u n c t i o n  c a l l W i n d o w ()
{
w i n d o w .o p e n ( " p r e v i e w . h t m " ) ;
}

</s c r i p t >

preview.htm is a simple HTML page . i need to pass values from main page to this page.

OR

Is it possibel to restrict the size of a VIEW to use it as a popup window?

OR

is there any other way to achieve this like.. the <bsp:call comp_id=" " />

tag , but i have no idea how to use it.

Thanks,

Anubhav.

Edited by: Anubhav Jain on Sep 12, 2008 3:38 PM

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

create another bsp page called pop.htm with page attributes (auto checked) required.

and from main page call this using javascript window.open method

and the url should be pop.htm?pageattr1=value&pattr2=val2......

and window.open method has parameter to decide the size of the pop up window. search google for winow.open parameters.

former_member184111
Active Contributor
0 Kudos

Hi Raja,

I did as suggested by you...but it is behaving strangely.

It works fine in debuging mode but when executed directly ....it is not working.

the scenario is:

Thers an image for preview as follows:

<htmlb:gridLayoutCell columnIndex="3" rowIndex="13">
<htmlb:i m a g e   s r c = " s _ b _ d e t l . g i f "   a l t = " P r e v i e w   C a r d "   o n C l i c k = " a d d r "   o n C l i e n t C l i c k = " c a l l W i n d o w ( ) ; " /  >
</htmlb:gridLayoutCell>

The JS code is:

f u n c t i o n   c a l l W i n d o w ( )
{
<%
data: title(5),
         fname(20),
         lname(20),
         comp(20),
         addr(20),
         city(20),
         state(20),
         pcode(20),
         country(20),
         phone(20),
         fax(20),
         email(241).

         alt_addr-title = request->get_form_field( 'title' ) .
         alt_addr-firstname = request->get_form_field( 'fname' ) .
         alt_addr-lastname = request->get_form_field( 'lname' ) .
         company = request->get_form_field( 'comp' ) .
         alt_addr-street = request->get_form_field( 'addr' ) .
         alt_addr-city = request->get_form_field( 'city' ) .
         alt_addr-region = request->get_form_field( 'state' ) .
         alt_addr-inhouse_ml = request->get_form_field( 'pcode' ) .
         alt_addr-country = request->get_form_field( 'country' ) .
         alt_addr-tel1_numbr = request->get_form_field( 'phone' ) .
         alt_addr-fax_number = request->get_form_field( 'fax' ) .
         alt_addr-e_mail = request->get_form_field( 'email' ) .
.

 CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie
          EXPORTING
            name                  = 'FORMFIELDS'
            application_name      = runtime->application_name
            application_namespace = runtime->application_namespace
            username              = sy-uname
            session_id            = runtime->session_id
            data_value            = alt_addr
            data_name             = 'alt_addr'
            expiry_date_rel       = 1.

%>

 w i n d o w . o p e n ( " . . / z _ b i z c a r d / p r e v i e w . h t m " ,   " W i n E " ,   " w i d t h = 2 4 0 , h e i g h t = 3 0 0 , t o o l b a r = n o , r e s i z a b l e = no ")
}

I was doing something similar...created a controller and a view , was calling the controller from window.open method with all other parameters for sizing etc.

How to pass a structure conatining data,from controller to the view...

Thanks,

Anubhav.

Edited by: Anubhav Jain on Sep 13, 2008 9:11 AM

athavanraja
Active Contributor
0 Kudos

if the structure has too much data either user server side cookie or application class

former_member184111
Active Contributor
0 Kudos

Hi Raja,

I did as suggested by you...but it is behaving strangely.

It works fine in debuging mode but when executed directly ....it is not working.

the scenario is:

Thers an image for preview as follows:

<htmlb:gridLayoutCell columnIndex="3" rowIndex="13">
<htmlb:i m a g e   s r c = " s _ b _ d e t l . g i f "   a l t = " P r e v i e w   C a r d "   o n C l i c k = " a d d r "   o n C l i e n t C l i c k = " c a l l W i n d o w ( ) ; " /  >
</htmlb:gridLayoutCell>

The JS code is:

f u n c t i o n   c a l l W i n d o w ( )
{
<%
data: title(5),
         fname(20),
         lname(20),
         comp(20),
         addr(20),
         city(20),
         state(20),
         pcode(20),
         country(20),
         phone(20),
         fax(20),
         email(241).

         alt_addr-title = request->get_form_field( 'title' ) .
         alt_addr-firstname = request->get_form_field( 'fname' ) .
         alt_addr-lastname = request->get_form_field( 'lname' ) .
         company = request->get_form_field( 'comp' ) .
         alt_addr-street = request->get_form_field( 'addr' ) .
         alt_addr-city = request->get_form_field( 'city' ) .
         alt_addr-region = request->get_form_field( 'state' ) .
         alt_addr-inhouse_ml = request->get_form_field( 'pcode' ) .
         alt_addr-country = request->get_form_field( 'country' ) .
         alt_addr-tel1_numbr = request->get_form_field( 'phone' ) .
         alt_addr-fax_number = request->get_form_field( 'fax' ) .
         alt_addr-e_mail = request->get_form_field( 'email' ) .
.

 CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie
          EXPORTING
            name                  = 'FORMFIELDS'
            application_name      = runtime->application_name
            application_namespace = runtime->application_namespace
            username              = sy-uname
            session_id            = runtime->session_id
            data_value            = alt_addr
            data_name             = 'alt_addr'
            expiry_date_rel       = 1.

%>

 w i n d o w . o p e n ( " . . / z _ b i z c a r d / p r e v i e w . h t m " ,   " W i n E " ,   " w i d t h = 2 4 0 , h e i g h t = 3 0 0 , t o o l b a r = n o , r e s i z a b l e = no ")
}

I was doing something similar...created a controller and a view , was calling the controller from window.open method with all other parameters for sizing etc.

How to pass a structure conatining data,from controller to the view...

Now in the onCreate event of the page PREVIEW.HTM in using;

CALL METHOD cl_bsp_server_side_cookie=>get_server_cookie
  EXPORTING
    name                  = 'FORMFIELDS'
    application_name      = runtime->application_name
    application_namespace = runtime->application_namespace
    username              = sy-uname
    session_id            = runtime->session_id
    data_name             = 'alt_addr'
  CHANGING
    data_value            = alt_addr.

and in the layout of PREVIEW.HTM in am using this alt-addr:

But if put a break point at the onCreate event of preview.htm and the execute i get the values in alt_addr but if i execute directly...it is empty in the layout?

What is the problem?

Thanks,

Anubhav.

athavanraja
Active Contributor
0 Kudos

use in the oninitialization event instead of oncreate

former_member184111
Active Contributor
0 Kudos

Hi Raja,

Actually the problem seems to be with the function callwindow:

in the code:

f u n c t i o n   c a l l W i n d o w ( ) 
{
<%
  alt_addr-title = request->get_form_field( 'title' ) .
  alt_addr-firstname = request->get_form_field( 'fname' ) .
  alt_addr-lastname = request->get_form_field( 'lname' ) .
  company = request->get_form_field( 'comp' ) .
  alt_addr-street = request->get_form_field( 'addr' ) .
  alt_addr-city = request->get_form_field( 'city' ) .
  alt_addr-region = request->get_form_field( 'state' ) .
  alt_addr-inhouse_ml = request->get_form_field( 'pcode' ) .
  alt_addr-country = request->get_form_field( 'country' ) .
  alt_addr-tel1_numbr = request->get_form_field( 'phone' ) .
  alt_addr-fax_number = request->get_form_field( 'fax' ) .
  alt_addr-e_mail = request->get_form_field( 'email' ) .
  .
  CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie
  EXPORTING
  name                  = 'FORMFIELDS'
  application_name      = runtime->application_name
  application_namespace = runtime->application_namespace
  username              = sy-uname
  session_id            = runtime->session_id
  data_value            = alt_addr
  data_name             = 'alt_addr'
  expiry_date_rel       = 1.
%>

w i n d o w . o p e n ("../z_bizcard/preview.htm", "WinE", "width=240,height=300,toolbar=no,resizable=no,menubar=no,status=no,titlebar=no,left=600,dependent=yes")
}

the code written in ABAP

(i.e. between <%  %>)

is never executed , alt_addr is empty in preview.htm.

Cant' we use ABAP code in JS function and call it onClientClick of a button?

Thanks,

Anubhav

Edited by: Anubhav Jain on Sep 13, 2008 1:41 PM

Answers (0)