cancel
Showing results for 
Search instead for 
Did you mean: 

Handling form submmit in AbstractPortalComponent?

Former Member
0 Kudos

G'day,

I have a portal component representing a logon page. This component is a subclass of AbstractPortalComponent and displays a form with a "submit" button.

I would like to set a cookie when the form is submitted. I can do this in JavaScript by setting the form's "onClick" attribute, but I would like to handle this programmatically within the AbstractPortalComponent subclass.

I thought I would capture any form submit event with the doRequestEvent() method, but this does not get called. Neither does doComponentEvent() nor handleEvent().

Can anyone provide an example of programmatically handling a form submit in an AbstractPortalComponent?

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi,

Is your submit botton a HTMLB button? Did you register a event on onClick method of this button?

If so the doRequestEvent method should be called.

Check the Request Flow here:

http://help.sap.com/saphelp_nw70/helpdata/EN/c1/69b8428e05c86ae10000000a155106/frameset.htm

So all the events should also execute doContent method.

Check this, for code that you should use in doContent method to capture the event:

Regards,

Praveen Gudapati

Former Member
0 Kudos

Hi Geoffrey,

To handle the event in AbstractPortalComponent, first step is to create the event that is raised when the user clicks, for example, a button.The portal runtime provides the interface IPortalComponentURI to generate this events:



uri = request.createPortalComponentURI();
uri.setPortalRequestEvent(request.createRequestEvent("EVENTNAME"));

To create an URL that can be used, for example, in a HTML, you have to convert the uri into an url string:



uri.toString();

If the user clicks on the button, the portal runtime will dispatch this event to a method named do<Eventname>. You have to implement this method in your AbstractPortalComponent. The IPortalRequestEvent object cotnains the attributes of the event.



public void doEVENTNAME(IPortalComponentRequest request, IPortalRequestEvent event) {

}

Hope this helps.

Do reward points if found helpful.

Thanks & Regards

Gourav.

Former Member
0 Kudos

Thanks for the info on using createRequestEvent(EVENTNAME) and doEVENTNAME(...), but I'm unclear on how the event name is associated with the form button. Do I put the uri as the form action, or use EVENTNAME in the form's onClick attribute?