Well actually I am not sure if it’s the best way to go, but you could just combine what you are already doing into two steps. Have the form submit without the _parent target so that it stays in fancybox. But if login is a success, then use that auto-closing behavior that you mentioned by submitting another form to the _parent. I’ve not tried this, so I’m just going on trying to take advantage of the existing behavior you mentioned: Click Here
<?php
if($session->login($input->post->user, $input->post->pass)) {
// login success
if($user->isSuperuser()) $url="./";
else $url="/members/";
$out = "<form id='success' action='$url' target="_parent" method='get'>" .
"<input type="hidden" name="login" value="1" />" .
"</form>" .
"<script>$(document).ready(function() { $('#success').submit(); }); </script>"; // submit the form
} else {
// display error
}