Client-Side input validation with RAP ClientScripting

Client-Side input validation with RAP ClientScripting

The RAP team started working on a new feature called ClientScripting. It’s still in it’s infancy and will not (yet) be part of the core framework , but its already very useable. The goal is to allow adding pieces of behavior to the client-components of RAP widgets. This makes it possible to have swift, dynamic user feedback in situations that require a certain amout of logic – so far a problematic scenario for RAP applications. It can be considered an alternative to custom widget development in many cases, and might also save some network traffic. We currently focus on the scenario of validating text input while typing, and will expand from there. Interactions between widgets are not yet possible, but is planned.

As you can test for yourself, the difference between server-side and client-side validation is quite noticeable.

When using ClientScripting, you will need to know very little JavaScript, and all API is as close to SWT as possible. The project has a wiki page with all further information you might need (including where to get the code). Note that you need RAP 1.5M6 or newer to use it. If you try it out, please consider giving some feedback, report bugs or file enhancement requests.

  • Mark
    Posted at 3:18 pm, March 26, 2012

    How does this affect single sourcing?

  • Tim
    Posted at 1:50 pm, March 30, 2012

    You cannot use the exact same code, but due to the similar API porting between SWT eventhandler and RAP ClientScripting is fairly easy.
    Server-side validation (can be combined with CS) can still be single-sourced of course.