cancel
Showing results for 
Search instead for 
Did you mean: 

Field validation on bsp page

Former Member
0 Kudos

Hi All

I am having a requirement like on bsp page user will enter employee id and press the submit button , then it should validated from database that the id is correct .

And if it's not correct then one pop up window will come with message please enter right employee id how i can achive this ?

regards

Sunanda Mandavi

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

thanks

Former Member
0 Kudos

Hi Amandeep

I had put below code for submit button option .

<htmlb:button id = "Send"

text = "SEND"

tooltip = "Press to send information"

onClick = "onInputProcessing(Submit)"

onClientClick = "javascript:validate();"

design = "emphasized" />

and for validation

<% IF lv_empid IS NOT INITIAL. %>

<script language="javascript">

function validate() {

alert('please enter valid id')

}

</script>

<% ENDIF. %>

but i am not getting any popup message .

Regards

Sunanda

Former Member
0 Kudos

Can you try exactly my code.

Thanks

A

Former Member
0 Kudos

Hi

Thanks for the response but this event will take place after clicking on the submit button .

Regards

Sunanda

Former Member
0 Kudos

<b>Layout</b>

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title="Check Pernr " >
    <htmlb:form>
      <htmlb:textView text   = "Personnel No."
                      design = "EMPHASIZED" />
      <htmlb:inputField id    = "pernr"
                        value = "<%= lv_pernr %>" />
 <%
if lv_no_pernr = 'X'.
%>
<script language="Javascript">
alert ("Personnel no. is not Valid")
</script>
<%endif.%>
   </htmlb:form>
  </htmlb:page>
</htmlb:content>

<b>ONINPUTPROCESSING</b>

DATA: l_pernr TYPE persno.


  DATA: data TYPE REF TO cl_htmlb_inputfield.
  data ?= cl_htmlb_manager=>get_data( request = runtime->server->request
                                         name     = 'inputField'
                                         id       = 'pernr' ).
  IF data IS NOT INITIAL.
    l_pernr = data->value.
  ENDIF.

CLEAR lv_no_pernr.
SELECT SINGLE pernr FROM pa0000 INTO l_pernr WHERE pernr EQ lv_pernr.

IF sy-subrc NE 0.
  lv_no_pernr = 'X'.
ENDIF.

<b>PAGE ATTRIBUTES</b>

lv_no_pernr	TYPE	FLAG
lv_pernr	TYPE	PERSNO

hope this helps.

A