Unable to retrieve form values in Bean Shell using hash variable

Confluence User - 22 Dec, 2017

Hi All,

I have a select box with Options Binder as 'Beanshell Form Binder'.

I am loading the options using Beanshell script from a database table which is working fine.

However I need to filter the database values based on a form text field (value= ABC) and I tried using below code:

String str = "#form.formtablename.fieldname#";

LogUtil.info("","("+str+") - my text field value");  

Current Result : String is getting printed as :

(#form.formtablename.fieldname#) - my text field

Expected Result: String should be printed as below:

ABC - my text field

Can you please let me know why the text value is not getting displayed.

 

beanshell

1


26 Dec, 2017
confluenceUser
1
confluenceUser

Hi

You can key in your form field used for select box filtering into the select box properties "Field ID to control available options based on Grouping".

Subsequently, in your SQL query where clause, add a question mark and Joget Workflow will replace the value of the filter field into the '?' query place holder. Remember to tick 'on' the "Use AJAX for cascade options?" checkbox.

 

Example:

Select * from dir_user where active=?

 

The form hash variable #form.formtablename.fieldname# is a Joget shortcut to PULL values from the database table on form load. It will work if the database table "formtablename" for record "id=123" already has a value in "c_fieldname" and id=123 is the record currently being displayed in your form. But if "id=123" is a new record (don't exist in database), the hash variable will not work.

 

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print