Search the FirstSpirit Knowledge Base
Dear FS Community,
I have a combo box as defined below and it fetches the data source values for labels.
<CMS_INPUT_COMBOBOX name="st_name" hFill="yes" singleLine="no" useLanguages="no">
<CMS_INCLUDE_OPTIONS type="database">
<LABELS>
<LABEL lang="*">#item.name</LABEL>
</LABELS>
<TABLE>DBName.tableTemplate</TABLE>
</CMS_INCLUDE_OPTIONS>
<LANGINFOS>
<LANGINFO lang="*" label="Name"/>
</LANGINFOS>
</CMS_INPUT_COMBOBOX>
Is there a way to copy the datasource value (st_name.value.fieldname) to an Input textbox in the same form with rules with First Spirit 5.2 May 2020 version? if so please help me with the solution.
Thanks and Best Regards,
Sathya
Hi Sathya,
take a look at: FirstSpirit Online Documentation - <ADD/> Calculating with dynamic forms
In this example a date filed is taken, some days are added and the result is stored into another field. - I guess this could also work with the value of a combobox and a text field. When the combobox is filled by a datasource you must step in a little bit deeper to get the actual field of that datasource you want to use because the combobox itself stores the whole dataset.
Greetings
Sandro
Hi Sandro
Thanks for answering the question. I tried several ways but nothing helped me. Or the other way, is it possible to store st_name.value.fieldname in st_name instead of datasource identifier?
Seems <ADD> property is only helpful in case of integers and time units.
Thank you,
Sathya
Hi Sathya and Sandro,
I don't think you can do this for a combobox with type database because you can't read properties/fields of the selected entity.
In addition you can't use them in ValueServices. The question is what you want to achieve by passing the label to a textfield.
Use another rule on it to verify the label is not empty or matches another condition?
In my opinion in that case a FS_BUTTON would be your best option.
Best regards
Felix
Hi Felix,
I want to feed the value from the data source to another utility with the label st_name. Currently,I get the unique ID out of it.
Could you please help me how I can use FS Button to achieve it?
Thank you,
Sathya
Hello Sathya,
that's pretty simple. Just add a FS_BUTTON component and as parameters pass the two fields (the comboxbox and the textfield for the name). Sth. like that (please choose better name - just used them to make it easier to understand):
<PARAMS>
<PARAM name="comboboxField">#field.st_name</PARAM>
<PARAM name="nameField">#field.st_namefield</PARAM>
</PARAMS>
Then createn Executable or for testing purposes a FirstSpirit Beanshell Script and assign it to the FS_BUTTON (FirstSpirit Online Documentation - FS_BUTTON )
The parameters are ApiRemoteFormField Objects that provide the same methods as FormField FirstSpirit Access-API
so the script would just have to get the value from st_combobox, get the name out of it and write it to st_namefield. Sth. like this (please add errorhandling and so on).
nameField.set(comboField.get().getValue().getValue("fieldname"));
Haven't tested the script.
Best regards
Felix