cancel
Showing results for 
Search instead for 
Did you mean: 

Read Table onBlur of Inputfield

Former Member
0 Kudos

Hi,

I have a inputfield say: t_comp_code where I want the user to enter the Company Code.Then I want to check the Company Code master table to see if the entry exists or not. This I want to do oBlur of the field and then output an error message in an alert box via Javascript.

How do I achieve reading an internal table & then calling the Javascript function if sy-subrc = 0?

And where do I select all values of the master table?

As I am new to BSP I am having problems visualizing this.

Please help.

Regards

Tejaswini

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

check out onClientClick you can activate Javascript there for a button element or so.

As for giving a variable to JavaScript you have to set the variable in your event handler then pass it to your page layout


<script>
alert(<%=myvalue%>);
</script>

If you set a page attribute called myvalue TYPE STRING and in OnCreate set


myvalue = 'hello'.

Do that on a test page and you will get a good idea how passing to JavaScript can work.

As for reading tables and so you can do that in the Event Handlers or in the page layout with ABAP.

athavanraja
Active Contributor
0 Kudos

OnBlur can be achieved like below.


   <htmlb:form>
      <%
  tmp_string = `<input onBlur="javascript:checkCompanyCode(this);"`.
      %>
      <bsp:findAndReplace find    = "<input"
                          replace = "<%= tmp_string %>" >
        <htmlb:inputField id        = "myInputField2"
                          value     = "ABC"
                          alignment = "left" />
      </bsp:findAndReplace>
    </htmlb:form>

Regards

Raja

Former Member
0 Kudos

Thanks Craig & Raja I was able to do my field validations based on your inputs.

Regards

Tejaswini

Former Member
0 Kudos

Great to hear!

Answers (0)