Select box
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 12:10 AM
I created a select box variable in record producer ,and I want the default text (which is not answer for the question) value to be visible but not included in the dropdown options. How can I achieve this?
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 04:35 AM
Hi @Pavan rishi
Try bellow onLoad client script once:
function onLoad() {
// Get the select box variable by its name (replace 'select_variable_name' with your variable name)
var selectBox = g_form.getControl('select_variable_name');
// Create a new option for the default text
var defaultOption = document.createElement("option");
defaultOption.text = "Please select an option"; // The default text you want to show
defaultOption.value = ""; // Ensure the value is empty or invalid
// Insert the default option at the top
selectBox.add(defaultOption, selectBox.options[0]);
// Make sure it's selected by default
selectBox.selectedIndex = 0;
// Make the default option non-selectable
selectBox.options[0].disabled = true;
}
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
rajesh