Display jQuery dialog onSubmit while HTML form is processing -
i have html form allows user add attachment x mb. because connection speeds users vary, show dialog says along lines of "your request processing. not navigate away page. dialog close when form submitted successfully". not verbatim similar. form posts , processed php. not looking progress bar or anything. friendly alert. have been looking @ jquery ui documentation examples show confirmation requires user intervention continue. want placeholder while processing happening. or links appreciated.
thanks in advance
so after tinkering , hours of searching able piece working solution doesn't require ajax. here is:
the head section
<script type="text/javascript"> $(document).ready(function (){ $("#loading-div-background").css({ opacity: 1.0 }); }); function showprogressanimation(){ $("#loading-div-background").show(); } </script>
the css
#loading-div-background{ display: none; position: fixed; top: 0; left: 0; background: #fff; width: 100%; height: 100%; } #loading-div{ width: 300px; height: 150px; background-color: #fff; border: 5px solid #1468b3; text-align: center; color: #202020; position: absolute; left: 50%; top: 50%; margin-left: -150px; margin-top: -100px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; behavior: url("/css/pie/pie.htc"); /* handles ie */ }
the html (truncated illustrate necessary parts)
<form id="frm_send" name="frm_send" method="post" action="<?php echo $_server['php_self']; ?>" enctype="multipart/form-data"> // fields omitted brevity <input type="submit" id="submit" name="submit" class="button" onclick="showprogressanimation();" value="send"> </form> <div id="loading-div-background"> <div id="loading-div" class="ui-corner-all"> <img style="height:32px;width:32px;margin:30px;" src="/images/please_wait.gif" alt="loading.."/><br>processing. please wait... </div> </div>
and end result looks this.
prevents user interfering process (unless of course click stop or exit browser (obviously)). works nicely, it's clean , works across chrome, ie, firefox, , safari using latest jquery , jquery ui libraries included google code repositories.
Comments
Post a Comment