
Overview:
Many times in our project we have requirement to trigger server side validation by Pressing TAB key (keyboard). Typically this is a demand from Customer who are usually new to SAP world. I myself had faced similar situation and convinced customer that it is required in SAP CRM to press "Enter" to get the error message aka validating the data.
In this blog I would explain how can we trigger Validation by pressing TAB key in SAP CRM Web UI.
Yes it is clear that we can also attach JavaScript (Attaching Java Script to a field in Table of SAP CRM Web UI) but complex validation logic (through BOL) is not possible or really complex.
Details:
By pressing Tab key on Web UI, it is actually fires client side event "Clientblur". We need to capture trigger event handler through JavaScript for the event Clientblur, and trigger server side event through BSP element <bsp: htmlbEvent>.
Step 1:
Copy CL_UIF_BP_SAMPLE_ITERATOR class to Z Iterator class. In method "IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START" (is used for new column) we need to capture "Clientblur". Below is sample code:
Step 4:
In .HTM page after Tableview / Tablecellartor code and BSP Event Element declaration, JavaScript event handler method should be written.
Test:
I have used for testing and Date field and by pressing the Tab key on Date field pops out error message "Date sdsd is invalid"
Summary:
I hope it would solve many business case problem where validation error by pressing Enter or Save button is too late. Please use the logic and if you have questions and / or comment, please add. Enjoy :smile:
Reference: CRM WebClient UI - Talking with Java Script - CRM - SCN Wiki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.