My custom control consists of a number of combo boxes and text input boxes within a panel. The combo box values depend on one another, so when a combo box is changed, a partial refresh is executed on the panel to refresh the values of the other combo boxes.
One of the text input boxes is also dependent on one of the combo boxes - let's say the combo box title is "Do you have any special requirements?" and the values are "Yes" and "No". If the value is "No" then the special_requirements text box is hidden, and saved as "N/A" to the document in a querySaveDocument event. If the value is "Yes" then the special_requirements text box is shown, and the user must fill it out, and their input is saved.
The problem I've been having is that if I compute the value of the "Visible" property of the text box, then it is shown/hidden appropriately, but any user input is cleared whenever the panel is refreshed - eg the user selects "Yes", inputs some text, then changes another of the combo boxes which causes a partial refresh - the text box is still shown, but is now empty.
Currently I am using a workaround where instead of computing the "Visible" property, I compute the CSS style, setting it to hidden when the text box is not required. However, this means a user could input to it despite selecting "No" in the combo box, so it is not an ideal solution. Is there are a way to preserve the user's previous input between refreshes, and remove it if the combo box option is changed from "Yes" to "No" using the "Visible" property?