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" />
<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.
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
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.
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.
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.
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 a comment