cancel
Showing results for 
Search instead for 
Did you mean: 

BSP application with Javasript preview functionality

dennis_bruder
Employee
Employee
0 Kudos

Hi guys,

I created a BSP business card application where the user can enter his data (name, address, phone...)within a form (<phtmlb:formLayoutInputField ..>).

I added a preview button and after pressing the button a JPG of the business card appears and the values from the form

are displayed on this JPG picture. This is realised with a javascript function.

I have the problem that javascript works on the client side. This means when the user clicks on the preview button the abap variables from my form are not filled with the user input.

At the moment I added another button 'Adopt text'. In this case a ok-code is raised on the abap side and the variables are filled (the entered text from the form is adopted). If the user now clicks the preview button everything works fine and the text is displayed on the JPG, but this approach is very uncomfortable. Has anybody an idea how I could implement such a preview functionality without clicking the 'adopt text' button?

Best regards

Dennis

Accepted Solutions (1)

Accepted Solutions (1)

thomasalexander_ritter
Active Contributor
0 Kudos

Hi,

>I have the problem that javascript works on the client

>side. This means when the user clicks on the preview button

>the abap variables from my form are not filled with the

>user input.

but the user has already entered his data into the inputfields, right? So in this case you can read the values of the inputfields using javascript and fill some javascript variables which can be accessed by the previewfunction. The code to get the value of an inputfield looks something like this:

var name = document.all('yourInputfieldNameId').value;

So your program should work like this:

1)Display site for user

2)User enters his data

3)User clicks preview button

4)Javascript function reads the entered data and passes it to the preview function

5)Display preview jpg

6)If the user wants to save the changes he clicks on the save button. The data will be sent to the server.

regards,

Thomas

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

There is another method.

You Can use java script code for showinng a pop window on the Preview button click event.

JS Code For Pop Up Window.

<script >

function popitup(url)

{

newwindow=window.open(url,'name','height=700,width=700,resizable=yes');

if (window.focus) {newwindow.focus()}

return false;

}

</script>

and on the layout page, use your preview button like this

<htmlb:button id = "VIEW_R"

text = "View"

design = "standard"

onClick = "clkViewR"

onClientClick = "return popitup('Budget_Display1.htm?<b>BD=<%= data %></b>')"/>

With the URL field of this button you can send values.

BD is the attribute to be used on the popup page and data is the value to be set in the parent window.

thanks and regards.

Mithlesh