DynamicPlaceholder
Overview
This module provides JavaScript actions and sample nanoflows to dynamically change textbox placeholders based on dropdown or reference selector using simple configuration and class name mapping.
Documentation
Typical usage scenario
In scenarios where only one value needs to be selected from multiple optional fields, instead of creating separate attributes for each option, a single string attribute can be used. By combining it with a dropdown or reference selector and dynamic placeholder functionality, the input field can adapt based on the selected option, reducing redundancy and simplifying the data model.
This module includes two JavaScript actions:
1. When an ENUM attribute is selected from a dropdown, the textbox placeholder updates dynamically based on the selected ENUM value.
2. When an associated value is selected in a reference selector, the textbox placeholder changes accordingly to reflect the selected reference.
Features and limitations
1. Dynamically updates textbox placeholders based on user selection.
2. Enhances form usability without requiring a page reload.
3. Requires basic JavaScript configuration.
Installation
Download the module from the Mendix Marketplace.
Configuration
In the USE ME folder, you will find the specific JavaScript actions required for this module.
In the Nanoflows folder:
1. OCH_Dropdown – Use this nanoflow when selecting an Enum value. It demonstrates how to pass the selected ENUM value to the JavaScript action.
2. OCH_ReferenceSelector – Use this nanoflow when selecting an associated value. It shows how to pass the string value to the JavaScript action.
These nanoflows should be used with the On Change event of the dropdown and reference selector widgets.
Additionally, there is a minor modification required in the JavaScript code: In line 37, replace "specificClassName" with the class name of the textbox whose placeholder you want to update.