cancel
Showing results for 
Search instead for 
Did you mean: 

Make Push button to do AT EXIT-COMMAND

Former Member
0 Kudos

Is there a way to mimic, the exit command push button?

For example:

Input field1 _________ (required field)

PB_CONTINUE PB_EXIT

if the user clicks PB_CONTINUE -> the user asked to enter the input field1.

if the user clicks PB_EXIT -> the user did not asked to enter the input field1.

I only managed to get validation (using doValidate) for ALL push button.

Any idea?

Thanks,

Iwan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Brian,

Thanks again for the tip. I was under the assumption that it's better do as much as possible at the client side, since there will be no communication to the server side. I guess, I was wrong

Regards,

Iwan

former_member181879
Active Contributor
0 Kudos

There are no black or white answers here. Just subtle shades of gray. Do what it takes to get the job done. But when one starts to jump through loops, and mangling all concepts to force something to work, then rather try another shade of grey!

From our own experience a quick trip to the server is definitely acceptable from time to time!

++bcm

Former Member
0 Kudos

Brian,

As always, it's an excellent explanation you gave about round trip to server in the event of an error. Even in our applications mostly we do server side validations, some times it is not possible to have client side validation after submitting the request and prevent submitting half the way when error is detected at server.

Could you please tell me why there is an error page in the BSP page/controller attribute and How to use it. Right now I am collecting all the errors from server and display them in the view usin textview control.

thanks,

suresh

former_member181879
Active Contributor
0 Kudos

Is this BSP related? If yes, give us maximum 25 line program to demonstrate the question.

++bcm

Former Member
0 Kudos

Yes it is. I would like if the user click exit button, the required field validation will be ignored... just like Exit function in ABAP world.

<%@page language="abap" %>

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

<htmlb:content design="design2003" >

<htmlb:page title="Suporting Document" >

<htmlb:group>

<htmlb:groupHeader>

<htmlb:textView text = "Suporting Document: Initial Screen"

design = "EMPHASIZED" />

</htmlb:groupHeader>

<htmlb:groupBody>

<htmlb:form doValidate = "true"

autoComplete = "false" >

<htmlb:textView text="Request number" />

<htmlb:inputField id = "sDRequestNumber"

required = "X"

doValidate = "true" />

<br>

<htmlb:button id = "sDEdit"

text = "Manage Supporting Document"

onClick = "onClick" />

<htmlb:button id = "sDExit"

text = "Exit"

onClick = "onClick" />

</htmlb:form>

</htmlb:groupBody>

</htmlb:group>

</htmlb:page>

</htmlb:content>

former_member181879
Active Contributor
0 Kudos

Good example, about 10 lines to many

Here a suggestion. I am not complete happy with the solution, but it is pragmatic and works.


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
 <htmlb:page>
   <htmlb:form id ="XYZ" 
               doValidate   = "true"
               autoComplete = "false" >
    <htmlb:textView text="Request number" />
    <htmlb:inputField id         = "sDRequestNumber"
                      required   = "X"
                      doValidate = "true" />
    <htmlb:button 
       id      = "sDEdit"
       text    = "Manage Supporting Document"
       onClick = "onClick" />
    <htmlb:button 
       id      = "sDExit"
       text    = "Exit"
 onClientClick = "window['doValidate_XYZ'] = null;"
       onClick = "onClick" />
   </htmlb:form>
 </htmlb:page>
</htmlb:content>

There are two important changes made to your example. First the form was given an ID, so that we know this value. Next the Exit button was given an onClientClick event. This is a piece of JavaScript that fires in browser first. All it does it overwrite the predefined validate method for this form will a null method.

++bcm

Former Member
0 Kudos

Hi Brian,

Thanks a lot. That's works just fine. Do you know how to do the same for the link at breadcrumb? I put the breadcrumb object at the same page as the input, so when I click the breadcrumb item, the validation kick in. Any idea? onClientClick is not available unfortunately

former_member181879
Active Contributor
0 Kudos

Yes, I have an idea. It will be some work from yourside.

Why not read all the appends in this forum for the last week or so? Somewhere there is a series of appends that describe how to intercept Javascript functions. What you want to do, is to intercept the htmlbSubmit function, and then do this same trick there. For signature, etc of this htmlbSubmit you will have to read the .js file we render.

My personal opinion: this is becoming messy. Remove all this client-side validation. Just do it at the server, and if the values are not ok, return page with error message. The extra roundtrip is no problem, it is only in error case.

++bcm