diff --git a/views/new-post.php b/views/new-post.php index 1a64eb5..8767024 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -98,7 +98,28 @@ $(function(){ latitude: position.coords.latitude, longitude: position.coords.longitude }, function(response) { + // save and restore the value entered in the custom fields + var custom_eat = $('#custom_eat').val(); + var custom_drink = $('#custom_drink').val(); + + var selected = false; + if($("#custom_drink:focus").length == 1) { + selected = '#custom_drink'; + } + if($("#custom_eat:focus").length == 1) { + selected = '#custom_eat'; + } + $("#entry-buttons").html(response); + + // restore the custom values entered + $('#custom_eat').val(custom_eat); + $('#custom_drink').val(custom_drink); + + if(selected) { + $(selected).focus(); + } + bind_keyboard_shortcuts(); }); diff --git a/views/partials/entry-buttons.php b/views/partials/entry-buttons.php index a5e981f..fa46095 100644 --- a/views/partials/entry-buttons.php +++ b/views/partials/entry-buttons.php @@ -18,7 +18,7 @@ } if($type == 'drink' || $type == 'eat') { echo '