Skip to Content
avatar image
Former Member

HTMLB->Button Event CASE Dyn Nav problem

Hi,

I am prototyping a solution in BSP which has a page with two buttons at the bottom, a BACK button and a SUBMIT button which both send the User to different pages, and I can't make the re-directs work.

I am trying to stick to HTMLB and not get lazy and use HTML.

I have a page call it page1.htm, at the bottom there is a submit button and back button with htmlb code as follows:

<htmlb:button text = "Back"

onClick = "event_1" />

&nbsp;&nbsp;

<htmlb:button text = "Submit Request"

onClick = "event_2" />

in the EVENT HANDLER for the OnInputProcessing Event I have the following CASE statement:

CASE event_id.

WHEN 'event_1':.

navigation->goto_page( 'default.htm' ).

WHEN 'event_2':.

navigation->goto_page( 'submitresult.htm' ).

ENDCASE.

the idea is that when the BACK button is pressed the OnInputProcessing event handler will pick this up and using the value of the EVENT_ID which can be either event_1 or event_2 the CASE statement will re-direct the User to the correct page.

Problem -> it doesn't work.

Does anyone have any ideas where I am going wrong.

Thanks for your time,

Milan.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Jul 06, 2004 at 07:29 PM

    Hi Milan,

    Let me shoot a little bit in the dark.

    The (old) event_id was used for exactly the case of hardwritten code. Look at IT00 for many examples how this is wired. When using HTMLB lib, it should always have the constant value 'htmlb'.

    Let us quickly look at a simple sample. We peek into SBSPEXT_HTMLB/button.bsp (note we placed the code in layout to make our testing easier), we see:

      DATA: event TYPE REF TO if_htmlb_data.
      event = cl_htmlb_manager=>get_event_ex( request ).
      IF event IS NOT INITIAL AND event->event_name = 'button'.
        ...here comes CASE , consider event->event_server_name
      ENDIF.
    

    I suspect that you do not have the other lines of code above.

    But hey, let us skip these simple examples. Why not look into the documentation (would have been faster than writing such a long question and the time for my answering). There stands actually a long blurb about just all of this scaffolding one needs to going.

    When you have a quiet moment, consider to read:

    <b>BSP Trouble Shooting: Getting Help</b>

    /people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help

    Some of the other ones are actually also not bad. You can checkout:

    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/weblogs/topic/24

    ++bcm

    Add comment
    10|10000 characters needed characters exceeded

    • Hallo Milan,

      Only been on the answer side in this forum, sometimes might make me a bit touchy. I see my share of questions per day where careful reading would definitely have saved the questions and the answers.

      Yes, your question was written clear and concise. For me it just very difficult to always judge exactly what you know or don't. Especially when people only "silently" follow the forum over a long time.

      I will in future "sticking to subjects I know" for all your questions, and refrain from shooting in the dark. Maybe not always a timely answer is a good answer. (I do try never to answer fluff, but then as writer I can not just my answers.)

      At least, in my defence I can quote: "solving my problem". So ROI maybe not perfect, but still positive.

      regards, brian

      PS: I previously forgot to write it, but there is also the technique of setting the target page directly in the browser. You can fill the onClientClick with some JavaScript in the direction of "document.location.href = 'previous_page.htm';" (code not tested). This will directly load the previous_page.htm without first the server roundtrip.

  • avatar image
    Former Member
    Jul 07, 2004 at 12:10 PM

    Hello Brian,

    on reflection, sorry for flaming you !

    Anyway to conclude I still have the problem - incase anyone out there has done this and would share their solution - this means using the Event handler in the BSP to have two buttons on a page redirecting to different pages.

    I don't really want to use javascript - in general I try to avoid it at all costs as it can cause more head aches that it is worth - so I would like to find a proper htmlb with use of event handler solution.

    For the record, in the htmlb examples I have not found an example which has two buttons on one page re-directing to different pages - one button is easy it's the default and can go to the current page or a different one, two or more in htmlb well... for now that is the problem of the century 😊

    Thanks,

    Milan.

    Add comment
    10|10000 characters needed characters exceeded

    • Hallo Milan, (interesting name, English?)

      Somehow we are just overlooking something. I quickly built a very small cut-and-paste example.

      Create a new BSP application, and add into it three pages called page1.htm, page2.htm and page3.htm. The source is below. (Note all three has the same event handler:).

      <b><u>onInputProcessing for all three pages</u></b>
      DATA: event TYPE REF TO if_htmlb_data.
      event = cl_htmlb_manager=>get_event_ex( request ).
      IF event IS NOT INITIAL AND event->event_name = 'button'.
        navigation->goto_page( event->event_server_name ).
      ENDIF.
      
      <b><u>page1.htm</u></b>
      <%@page language="abap" otrTrim="true"%>
      <%@extension name="htmlb" prefix="htmlb"%>
      <htmlb:content design="design2003">
        <htmlb:page>
          <htmlb:form>
            <htmlb:button       text          = "Page 2"
                                design        = "NEXT"
                                onClick       = "page2.htm" />
          </htmlb:form>
        </htmlb:page>
      </htmlb:content>
      
      <b><u>page2.htm</u></b>
      <%@page language="abap" otrTrim="true"%>
      <%@extension name="htmlb" prefix="htmlb"%>
      <htmlb:content design="design2003">
        <htmlb:page>
          <htmlb:form>
            <htmlb:button       text          = "Page 1"
                                design        = "PREVIOUS"
                                onClick       = "page1.htm" />
            <htmlb:button       text          = "Page 3"
                                design        = "NEXT"
                                onClick       = "page3.htm" />
          </htmlb:form>
        </htmlb:page>
      </htmlb:content>
      
      <b><u>page3.htm</u></b>
      <%@page language="abap" otrTrim="true"%>
      <%@extension name="htmlb" prefix="htmlb"%>
      <htmlb:content design="design2003">
        <htmlb:page>
          <htmlb:form>
            <htmlb:button       text          = "Page 2"
                                design        = "PREVIOUS"
                                onClick       = "page2.htm" />
          </htmlb:form>
        </htmlb:page>
      </htmlb:content>
      

      I highly recommend to run this in design2003. You will love that PREVIOUS/NEXT design on the buttons. If this example is not working for you, there are a few other things to be checked. But first try this.

      ++bcm

  • avatar image
    Former Member
    Jul 07, 2004 at 01:47 PM

    Hi,

    I can do it in html as follows...

    <%@page language="abap"%>

    <%@extension name="htmlb" prefix="htmlb"%>

    <htmlb:content design="design2003">

    <htmlb:page title = "test calling a different page from buttons">

    <BR>

    <BR>

    <BR>

    <Form name="myform">

    <input type="submit" name="onInputProcessing(event_1)" value="to Page 1">

    <input type="submit" name="onInputProcessing(event_2)" value="to Page 2">

    <input type="submit" name="onInputProcessing(event_3)" value="to Page 3">

    </Form>

    </htmlb:page>

    </htmlb:content>

    Event Handler... onInputProcessing...

    • event handler for checking and processing user input and

    • for defining navigation

    CASE event_id.

    WHEN 'event_1':.

    navigation->goto_page( 'default.htm' ).

    WHEN 'event_2':.

    navigation->goto_page( 'submitresult.htm' ).

    WHEN 'event_3':.

    navigation->goto_page( 'confirm1.htm' ).

    ENDCASE.

    but I want to do this in htmlb with a htmlb form and htmlb buttons, if anyone can give any hints as to how to achieve the same as the above with htmlb it will be much appreciated.

    Thanks,

    Milan.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2004 at 01:56 PM

    Eureka,

    thank you very much for your time and assistance - now you are the expert of navigation redirections.

    In the app I am designing, like your definition of the scaffolding, getting these buttons to work in htmlb was one of the final pieces in the scaffolding puzzle - everything else works.

    Thanks again and may this thread help others who are having to solve this in principle very simple problem.

    Milan is a Czech name.

    Thanks again,

    Milan.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2004 at 01:17 PM

    Now it seems easy indeed, but I didn't get to that solution some time ago when I needed to do something similar.

    It's really elegant, and I'm sure it would be useful to add it in the "BSP Trouble Shooting: Frequently Asked (Short) Questions" weblog because as Milan said, probably other people have faced (or will face) this question one day.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Milan,

      You must not think of differences between the libraries, but more extensions of. Once we had to do new work, we did not want to change the existing HTMLB library, so we created the XHTMLB library. And then, when we did the design2003, we added again the new controls into the PHTMLB library. These are just add-on libraries.

      Unfortunately documentation was do only very late for the PHTMLB lib. If I am not mistaken, maybe SP40+. Until then, there is only the BSP example SBSPEXT_PHTMLB, direct questions or some reverse engineering.

      brian