Editor passing other columns to php that havent been changed
Editor passing other columns to php that havent been changed
I have a problem where i have multiple columns in my table.
One is a select2 and the value that is shown in the table might not be in the select2 options. i.e - i set something as inactive so its not selectable anymore but i still want the value to stay the same.
Now when i change one of the other fields in the table it passes the changed field and also a null/empty for the select2 field
Does that make sense? And is that the expected outcome? I could code around it if i have to. Just wondering if thats the desired outcome
Answers
It is the expected outcome since Select2 acts like a
select
element. If the value isn't available in the list of options, then it can't be selected (i.e. it can't be the current value) and thus it just selects the first option in the list.What then happens is that when Editor submits the data to the server, it is checking to find all the different values - in this case since the original value is not available and can't be the current value, there is a new value and hence that is submitted.
The ideal way to address this would be to have the current value selectable in the list of Select2 options.
Allan