Validator with groovy database connection


I'm developing with Bonita CE 6.3.2

I'm newbie and tried a lot to find answer for this but without sucess !

1) I created an instantiation form for anonymous access. I've text field where user inputs a value. I need to validade if that value exists in a mysql table. How can I do it ? Can you please explain be step by step how can I write some groovy code to achieve this ?

2) another question: If I have other textbox on the same instantiation form and If I want to set it's value based on a result of a single value from a query to one mysql table, how can I do it ?

Trying to explain it betetr:

1) I have a mysql table with zip codes => columns: ZIP_Code , Name

I ask something like ZIP_Code to user.
First I want to validade that Zip_Code exists in mysql table Second and want to set value of other text field with name of that zip_code

Thanks for any cooperation.

1 answer


Because you're using the instantiation form I would do it this way...

1) Create the form and use a simplebutton, not a submit button 2) add a piece of Javascript code on the simplebutton to validate the field and check the MySQL database, at the same time retrieving and populating the second field. 3) After which the user can press the next step.

It's only a pointer as I don't do Javascript...

regards Seán