Tag Archives: Javascript

UI and other network considerations – Embracing the Network lunch’n’learn

This talk is available in various forms across the web and it’s interesting the difference in reaction it received – with the old team at Haymarket we came up with about two pages of suggested changes to our front-end code and other improvements.

At Mountain Warehouse, a lot less interest – but then the team is fairly back-end focused and never really get to play with the UI.

Note: this is a different video of the same talk as the original has vanished.

SmashingConf 2015 Barcelona: Patrick Hamann — Embracing the network from Smashing Magazine on Vimeo.

Automatically submitting a form with javascript – don’t break the back button!

There’s a problem with automatically submitting a form with javascript – by just calling the submit() method – you break the back button. We can use the fact that browsers remember form values to prevent this from happening.

<input type='hidden' id='submitted' name='submitted' value=''>
<script>
if (document.getElementById('submitted').value == '') {
document.getElementById('submitted').value = 'yes';
document.getElementById('wp_form').submit();
}
</script>

UPDATE: Forgot to test in IE. This doesn’t work in IE6 at least, but I could do with fixing the code so look for updates.