Rasmus Vind
Well-known member
I am experiencing something very weird. I am creating an overlay in which I am allowing the user to drag and drop files into and more. This is done by replacing some of the contents of the form with previews of the uploaded files. This results in the fact that the default XenForo/HTML form reset button cannot fully clear the state of this upload, so I made this:
Pay attention to the 'reset' part in particular.
This worked well for me. When the user clicks "Submit", the form is submitted and if errors occur, he can click the "Overlay" button again and continue where he left. If it finished successfully, the form is cleared by XenForo. If he clicks cancel, my code is DeCaching the form so he can start over.
But... I have compiled a list of steps to make this not work, here goes:
I have absolutely no idea what is going on.
I have attached a sample project to test this with and there is a video link at the bottom. If you try my sample, go to this page:
https://dl.dropboxusercontent.com/u/323865/2015-01-22 Rasample.mov
Code:
<script type="text/javascript">
XenForo.RasampleForm = function($form) {
new XenForo.MultiSubmitFix($form);
return $form.bind({
AutoValidationBeforeSubmit: function(e) {},
AutoValidationComplete: function(e) {},
reset: function() {
var overlay;
overlay = $form.closest('div.xenOverlay').data('overlay');
return overlay.close().getTrigger().data('XenForo.OverlayTrigger').deCache();
}
});
};
XenForo.register('form.RasampleForm', 'XenForo.RasampleForm');
</script>
This worked well for me. When the user clicks "Submit", the form is submitted and if errors occur, he can click the "Overlay" button again and continue where he left. If it finished successfully, the form is cleared by XenForo. If he clicks cancel, my code is DeCaching the form so he can start over.
But... I have compiled a list of steps to make this not work, here goes:
- Click "Overlay"
- Click "Cancel"
- Click "Overlay"
- Click outside the box in the grey area
- Click "Overlay"
I have absolutely no idea what is going on.
I have attached a sample project to test this with and there is a video link at the bottom. If you try my sample, go to this page:
Code:
http://your/xenforo/installation/rasample
https://dl.dropboxusercontent.com/u/323865/2015-01-22 Rasample.mov
Attachments
Last edited: