cancel
Showing results for 
Search instead for 
Did you mean: 

A problem about button

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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