-
-
Notifications
You must be signed in to change notification settings - Fork 167
Description
This is a rather serious regression that is caused by changes in pull request #2735. That pull request changed the inputs that were previously text inputs into number inputs using place holders for those textual type values. However, it also sets the value to the actual textual value in those cases. However, browser's do not ever submit textual values ever for number inputs. The result is that if one of those textual type values is not the default value for the field, then it will be set to the default value anytime the form is submitted.
For example, the "Show Me Another" field has two textual values. Those are "Never" and "Course Default", corresponding to the numeric values of -1 and -2, respectively. The default for this happens to be -1 or "Never" (that is really wrong though, it should be -2 or "Course Default"). So if the value for a problem is set to -2 (i.e., "Course Default"), then when the problem set detail page is loaded the place holder reads "Course Default" as it should, and the value of the input from the server is the text "Course Default". So now click the "Save Changes" button without making any changes. The browser submits the empty string for that parameter since the original value from the server is not valid for the number input (in fact the browser immediately changes the invalid text value from the server to the empty string as soon as the page loads). So the server now gets the empty string from the form submission and then uses the default value for the field.
One of the worst manifestations of this is if you have all of the problems set for show me another to use the course default, and then you select the option to add a problem to the set, and then save changes. Now all of the problems in the set have show me another disabled (set to "Never").
There are several possible fixed, but one must be made and this certainly needs a hotfix.
One possible fix is to try to make the number type input work. It may work that anytime the server receives an undefined value and the current value is one of these textual type values, then the setting is not change. This is probably the ideal way to go, but I am not entirely sure that it will fully work. I haven't tried to implement it yet.
Another possible fix is to stop using these textual values at all. Instead just show -2 to mean "Course Default" and -1 to mean "Never", and count on the help for the input being sufficient to inform the user what that means. This is certainly the least transparent way to go.
The only other fix I can think of is to go back to how it was before with a text input and actual values of "Course Default" or "Never" again. This way we know works, but it is not exactly ideal.