How to dynamically change the display value of the selected option in a select box variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 04:03 AM
Hi,
I have created a select box variable, where I am creating the options dynamically using g_form.addOption(), which is working fine.
Below are some sample options
1. label : 12345 Bank of India, value : 12345, displayValue: 12345 Bank of India
2. label: 67891 State Bank of India, value: 67891, displayValue: 67891 State Bank of India
After I select any of the above options, I want to change the label of the selected option equal to value.
Because I want to show the users the number and the bank name while selecting but after selection I want the variable to show only the number.
IS that possible??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 04:38 AM
Hi Achyut,
I did exactly as you suggested. Because while selecting I want the user to know the bank name of the code they are selecting . So I used
g_form.addOption('field_name', '12345', '12345 Bank of India') ;
What I want is after I selected the 12345 Bank of India option. I want the variable to display only 12345
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 05:32 AM
@suvro :
Let me understand your problem again you want this value to be seen on the form while selection or you want to see the value to be there on the variable for the submitted request ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 06:23 AM
Hi Achyut,
When the user is selecting the values he should be seeing option like below in the dropdown
12345 Bank of India
67891 State bank of India
23767 Punjab National Bank
And suppose he selects 23767 Punjab National Bank. After selecting, the variable should display only 23767
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 07:16 AM
@suvro For that Functionality you need to take "lookup select box" in place of select box and with its feature you will be able to get 23767 Punjab National Bank. as an option and 23767 after selection.
Regards
Achyut
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 07:19 AM
Hi Achyut,
Yes, for that I need a table to store the values. But I dont have that luxury 😀