Skip to Content
author's profile photo Former Member
Former Member

A problem about button

hi guys

morning.

i use MVC to develop a BSP page ,in my layout there are two part,

one is the inputfields and a button ,

the other is the tableview to display the search result.

and if the user began to click the button,firstly i use the javascript to check their input data,such as the user id may only the numeric character ,the code of the button like this

<htmlb:form id = "Find_caller"

method = "post"

validationScript = "return checkInput();">

<htmlb:button id = "BUTTON|V08|B01"

text = "<%=otr(/spn/smb/smbv08_008)%>"

onClick = "BUTTON|V08|B01"

onClientClick = "setButton('BUTTON|V08|B01')"

tooltip = "<%=otr(/spn/smb/smbv08_008)%>"/>

the javascript code is :

var pageButton = "";

function setButton (button)

{

pageButton = button;

}

function checkInput()

{

switch (pageButton)

{

case 'BUTTON|V08|B01':

......

......

break;

default:

return true;

}

}

in the code form i use the validationScript is to avoid after the button check the client code ,it will still go to check the server code .

but my query is:

after the result table has been got, if i clear the input fields then want to sort or see the next page of the tableview ,it also trigger the javascript code ,but i am new in BSP page.

i don't know how to solve the problem,may be i should use the <b>htmlbevent.cancel</b>?can someone help me to solve the problem?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 09:41 AM

    hi William,

    You can use an ABAP variable and set its value when you retrieve some value in your table.Before the javascript is executed,you can check the value and then the javascript can be executed or not.

    For eg:you could check the value of a Flag set when table has some values,or maybe you can check the table if it has some values and then execute the javascript

    <head>
    <script language="javascript">
    
    function checkInput()
    
      {
    
       <% if itab is not initial. %>
    {    
    case 'BUTTON|V08|B01':
    ......
    ......
    break;
    
    
    default:
    return true;
    
      
    }
       <%endif.%>
      }
    

    HOpe this helps,

    Regards,

    Siddhartha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2005 at 03:24 PM

    hi Siddhartha Jain ,

    i just clear the pageButton after the first case after the javascript code ,and now the problem has been solved.

    thank you guy

    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.