Skip to Content

BSP application with Javasript preview functionality

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 06, 2005 at 09:33 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2005 at 06:37 AM

    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?BD=<%= data %>')"/>

    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

    Add a comment
    10|10000 characters needed characters exceeded

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.