Skip to Content
avatar image
Former Member

Field validation on bsp page

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 22, 2007 at 03:38 PM

    <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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 22, 2007 at 04:28 PM

    Hi

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

    Regards

    Sunanda

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 22, 2007 at 04:32 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 23, 2007 at 11:46 AM

    thanks

    Add comment
    10|10000 characters needed characters exceeded