-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mlContentField insertion order leading to serious data loss #70
Comments
Comment by johnclause Tim, there is a compatibility problem with "Visual Composer" and other "Visual Whatever": qTranslate-Team/qtranslate-x#27. It seems to me the current design of mlContentField related things will have to be changed soon to enable better compatibility. We may not rename fields anymore in future. That is why it is better not to rely on the low level specifics of the code and only use high level interface. We can change the high level interface to accommodate your needs. On this particular issue, I never knew that order actually matters, although it is kind of making sense, after you mentioned it. What if we always append to the end of form? This will keep the order. Can you think of anything which may get broken if we do that? |
Comment by funkjedi I think always appending to the end of the form would work great. The fields would still be direct descendants of the form so I can't imagine anything would break. |
Comment by johnclause I also do not see what can break, so the latest on github puts it at the end. Is there still anything you need to change on -X? |
Comment by johnclause Hi Tim, I am about to release next update based on the latest at github. Are you all right? Can you do all you need? |
Comment by johnclause I assume it is closed. Please, open new one if there is more to worry about. |
Comment by johnclause Hi Tim (@funkjedi), I cannot believe it, but putting fields to the end of form gave trouble to one of the users: https://wordpress.org/support/topic/problems-with-exisiting-posts. If you are in the mood to solve puzzles, I can give you access to the user test site. Indeed, the post does not get saved, when "content" input field is the last one in the form. But it only a trouble for some posts, and not the other. Can you imagine that? I did not dig it into the WP code, there must be some explanation. For now, I changed common.js again to insert hidden fields right before their originals. This should also keep the order for you. Could you test please, the latest on github? |
Comment by johnclause Tim, I think the order would be fine for you, what I more worry about is that those hidden input fields in the middle will add some spaces on the view, although, in theory, they should not. You have pretty complex pages, and I hope that you would notice some layout changes. Would you find time to test it before I break a few thousands of users ;) |
Issue by funkjedi
Thursday Mar 05, 2015 at 23:50 GMT
Originally opened as qTranslate-Team/qtranslate-x#70
When qTranslate-X adds content hooks
qtranxj_ce()
inserts themlContentField
at the top of the form. This results in the fields being added in reverse order. Under normal circumstances this has no adverse affects.However it can have serious affects when the field names utilize the array notation. For example:
As you can see the third field in the DOM essentially wipes out the values of the other fields when the form is loaded into the
$_POST
array by PHP causing some serious data loss.I've worked around it for now by hooking
qtranxj_ce()
and manually reordering the DOM nodes. It's a pretty ugly hack but it works for now.The text was updated successfully, but these errors were encountered: